On 08/12/11 02:41, Linus Torvalds wrote:
On Tue, Dec 6, 2011 at 3:58 PM, Kees Cook<keescook@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxxxxx
Cambridge, United Kingdom +44-7545-209 100
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html