public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <kees.cook@canonical.com>
To: James Morris <jmorris@namei.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [SECURITY] /proc/$pid/ leaks contents across setuid exec
Date: Mon, 7 Feb 2011 17:14:45 -0800	[thread overview]
Message-ID: <20110208011445.GF1457@outflux.net> (raw)
In-Reply-To: <alpine.LRH.2.00.1102081127330.3342@tundra.namei.org>

Hi James,

On Tue, Feb 08, 2011 at 11:44:40AM +1100, James Morris wrote:
> On Mon, 7 Feb 2011, Kees Cook wrote:
> 
> > $ ./procleak.py auxv,syscall /usr/bin/passwd
> > running
> > AT_BASE:   0x7f2828bde000
> > AT_RANDOM: 0x7fff80bde7c9
> > Changing password for kees.
> > (current) UNIX password: 0 0x0 0x7fff80bdda90 0x1ff 0x7fff80bdd580 0x7f2828dc57c0 0x7f28287cec1d 0x7fff80bdd088 0x7f28282fe6c0
> > 
> > There needs to be some way to break the connection to these files across
> > the setuid exec, or perform some sort of revalidation of permissions. (Maybe
> > check dumpable?)
> 
> The way to do this is to set O_CLOEXEC.

Sure, I know about O_CLOEXEC, but this is about protecting the
just-been-execed setuid process from the attacking process that has no
reason to set O_CLOEXEC.

Something like this needs to be enforced on the kernel side. I.e. these
file in /proc need to have O_CLOEXEC set in a way that cannot be unset.

> Changing the behavior in the core kernel will break userspace.

I don't think /proc/$pid/* needs to stay open across execs, does it? Or at
least the non-0444 files should be handled separately.

-Kees

-- 
Kees Cook
Ubuntu Security Team

  reply	other threads:[~2011-02-08  1:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-07 23:14 [SECURITY] /proc/$pid/ leaks contents across setuid exec Kees Cook
2011-02-08  0:44 ` James Morris
2011-02-08  1:14   ` Kees Cook [this message]
2011-02-08  3:43     ` James Morris
2011-02-08  4:27       ` Kees Cook
2011-02-08 20:17         ` Eric W. Biederman
2011-02-10  2:44           ` James Morris
2011-02-10  3:41             ` Eric W. Biederman
2011-02-10  6:38               ` 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=20110208011445.GF1457@outflux.net \
    --to=kees.cook@canonical.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    /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