[Top] [All Lists]

Re: extended attributes security problem

To: Ethan Benson <erbenson@xxxxxxxxxx>
Subject: Re: extended attributes security problem
From: Andi Kleen <ak@xxxxxxx>
Date: Sun, 7 Apr 2002 13:16:19 +0200
Cc: Andreas Gruenbacher <ag@xxxxxxxxxxx>, linux-xfs@xxxxxxxxxxx
In-reply-to: <20020406161039.J1524@xxxxxxxxxxxxxxx>
References: <20020405234103.F1524@xxxxxxxxxxxxxxx> <Pine.LNX.4.33.0204061724480.12984-100000@xxxxxxxxxxxxxxxx> <20020406161039.J1524@xxxxxxxxxxxxxxx>
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/
On Sat, Apr 06, 2002 at 04:10:40PM -0900, Ethan Benson wrote:
> On Sat, Apr 06, 2002 at 06:28:42PM +0200, Andreas Gruenbacher wrote:
> > > 1) some sort of mount options to change xattr semantecs, for example
> > 
> > This does not address the real problem, and therefore makes no sense.
> i agree, i was mainly looking for options to let me close this hole as
> fast as possible.

I'm proposing this patch. As Andreas pointed out it doesn't make much sense
to set ACLs on symlinks or special devices. I still allow it for root.

Not allowing them for symlinks could be a problem for some other non ACL
uses of EAs (e.g. if a GUI fs browser wanted to store an icon in there), but 
this is probably not a too big problem right now. 

Of course this makes the existence of l{get,list,remove}attr a bit
questionable, but then at least root can do something with them still.


--- linux-work/fs/xattr.c-o     Thu Mar 21 18:15:26 2002
+++ linux-work/fs/xattr.c       Sun Apr  7 13:03:06 2002
@@ -67,6 +67,11 @@
        if (flags & ~(XATTR_CREATE|XATTR_REPLACE))
                return -EINVAL;
+       /* Do not allow creation of EAs on special files and symlinks. */
+       if (!S_ISREG(d->d_inode->i_mode)  && !S_ISDIR(d->d_inode->i_mode) &&
+               !capable(CAP_SYS_ADMIN))        
+               return -EPERM; 
        error = strncpy_from_user(kname, name, sizeof(kname));
        if (error == 0 || error == sizeof(kname))
                error = -ERANGE;

<Prev in Thread] Current Thread [Next in Thread>