linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <kees.cook@canonical.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Eric Paris <eparis@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	James Morris <jmorris@namei.org>,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org,
	Randy Dunlap <rdunlap@xenotime.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jiri Kosina <jkosina@suse.cz>,
	Dave Young <hidave.darkstar@gmail.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	David Howells <dhowells@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Tim Gardner <tim.gardner@canonical.com>,
	"Serge E. Hallyn" <serue@us.ibm.com>
Subject: Re: [PATCH v3] fs: allow protected cross-uid sticky symlinks
Date: Tue, 1 Jun 2010 14:07:34 -0700	[thread overview]
Message-ID: <20100601210734.GD4098@outflux.net> (raw)
In-Reply-To: <20100601190102.GT31073@ZenIV.linux.org.uk>

On Tue, Jun 01, 2010 at 08:01:02PM +0100, Al Viro wrote:
> On Tue, Jun 01, 2010 at 11:52:48AM -0700, Kees Cook 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. The common method of exploitation of this flaw
> > is to cross privilege boundaries when following a given symlink (i.e. a
> > root process follows a symlink belonging to another user).  For a likely
> > incomplete list of hundreds of examples across the years, please see:
> > http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=/tmp
> > 
> > The solution is to permit symlinks to only be followed when outside a sticky
> > world-writable directory, or when the uid of the symlink and follower match,
> > or when the directory owner matches the symlink's owner.
> > 
> > Some pointers to the history of earlier discussion that I could find:
> 
> I don't buy it.  If we are concerned about the symlinks in the middle of
> pathname, your checks are useless (mkdir /tmp/a, ln -s whatever /tmp/a/b,
> have victim open /tmp/a/b/something).  If we are not, then your checks are
> in the wrong place.

Well, that's not traditionally where the problems happen, but I have no
problem strengthening the protection to include a full examination of the
entire path looking for sticky/world-writable directories.

If not, what is the right place for the checks?

> "The more we prohibit, the safer we are" is best left to the likes of TSA;
> if we are really interested in security and not in security theatre or
> BDSM fetishism, let's make sure that heuristics we use make sense.

I'm not suggesting we remove symlinks.  :)  I don't feel that there is any
theatre here, since it only eliminates a strictly bad situation.  If there
are even more strictly bad situations, then we should eliminate those too.

-Kees

-- 
Kees Cook
Ubuntu Security Team

  reply	other threads:[~2010-06-01 21:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01 18:52 [PATCH v3] fs: allow protected cross-uid sticky symlinks Kees Cook
2010-06-01 19:01 ` Al Viro
2010-06-01 21:07   ` Kees Cook [this message]
2010-06-01 21:45     ` Al Viro
2010-06-01 22:20       ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100601210734.GD4098@outflux.net \
    --to=kees.cook@canonical.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=eparis@redhat.com \
    --cc=hch@infradead.org \
    --cc=hidave.darkstar@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=jmorris@namei.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rdunlap@xenotime.net \
    --cc=schwidefsky@de.ibm.com \
    --cc=serue@us.ibm.com \
    --cc=tim.gardner@canonical.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).