[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EE05A87.1050904@kingswood-consulting.co.uk>
Date: Thu, 08 Dec 2011 14:34:47 +0800
From: Frank Kingswood <frank@...gswood-consulting.co.uk>
To: linux-kernel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2011.1] fs: symlink restrictions on sticky directories
On 08/12/11 02:41, Linus Torvalds wrote:
> On Tue, Dec 6, 2011 at 3:58 PM, Kees Cook<keescook@...omium.org> wrote:
>> A long-standing class of security issues is the symlink-based
>> time-of-check-time-of-use race, most commonly seen in world-writable
>> directories like /tmp.
>
> Ugh. I really dislike the implementation.
>
> Wouldn't it be much nicer to instead actually use the symlink
> protection fields, and make the rules be:
>
> - creating a symlink as root does the traditional "lrwxrwxrwx" thing
> - creating a symlink in a directory you own similarly does "lrwxrwxrwx"
> - creating a symlink anywhere else (which implies either sticky or
> world-writable directory) does "lrwx------", so only you can use it.
>
> That seems to be much nicer semantics, and makes the protection
> *visible* instead of some kind of hacky run-time random behavior
> depending on some invisible config option that people aren't even
> aware of.
This sounds really good way to go about it, but it seems that an
implementation might be invasive.
Currently the symlinks are created in the file system e.g. ext4_symlink
has the S_IFLNK|S_IRWXUGO buried in it. It is likely other fs's follow
this model too.
Also, having tried creating such a link, it seems that the read-side
permissions check (at least in generic_readlink) is missing.
Frank
--
------------------------------------------------------------------------
Frank A. Kingswood frank@...gswood-consulting.co.uk
Cambridge, United Kingdom +44-7545-209 100
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists