Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 08 Dec 2011 14:34:47 +0800
From: Frank Kingswood <frank@...gswood-consulting.co.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
CC: Kees Cook <keescook@...omium.org>,
  Andrew Morton <akpm@...ux-foundation.org>,
  Al Viro <viro@...iv.linux.org.uk>, linux-kernel@...r.kernel.org,
  linux-fsdevel@...r.kernel.org, linux-doc@...r.kernel.org,
  Randy Dunlap <rdunlap@...otime.net>, Rik van Riel <riel@...hat.com>,
  Federica Teodori <federica.teodori@...glemail.com>,
  Lucian Adrian Grijincu <lucian.grijincu@...il.com>,
  Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <a.p.zijlstra@...llo.nl>,
  Eric Paris <eparis@...hat.com>,
  Dan Rosenberg <drosenberg@...curity.com>,
  kernel-hardening@...ts.openwall.com
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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.