mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
	Serge Hallyn <serge.hallyn@ubuntu.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Sean Pajot <sean.pajot@execulink.com>,
	lxc-devel@lists.linuxcontainers.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [lxc-devel] Kernel bug? Setuid apps and user namespaces
Date: Fri, 11 Apr 2014 23:52:28 +0200	[thread overview]
Message-ID: <20140411215228.GA27354@mail.hallyn.com> (raw)
In-Reply-To: <CALCETrULqdffvHZMV_4hobs8=YX6hRSagkvR4opycBKsfTaTtg@mail.gmail.com>

Quoting Andy Lutomirski (luto@amacapital.net):
> On Mon, Apr 7, 2014 at 11:13 AM, Serge E. Hallyn <serge@hallyn.com> wrote:
> > Quoting Andy Lutomirski (luto@amacapital.net):
> >> I'm starting to think that we need to extend dumpable to something
> >> much more general like a list of struct creds that someone needs to be
> >> able to ptrace, *in addition to current creds* in order to access
> >> sensitive /proc files, coredumps, etc.  If you get started as setuid,
> >
> > Hm, yeah, this sort of makes sense.
> >
> >> then you start with two struct creds in the list (or maybe just your
> >> euid and uid).  If you get started !setuid, then your initial creds
> >> are in the list.  It's possible that few or no things will need to
> >> change that list after execve.
> >>
> >> If all of the entries and current->cred are in the same user_ns, then
> >> we can dump as userns root.  If they're in different usernses, then we
> >> dump as global root or maybe the common ancestor root.
> >> setuid(getuid()) and other such nastiness may have to empty the list,
> >> or maybe we can just use a prctl for that.
> >
> > A few questions,
> >
> > 1. is there any other action which would trigger adding a new cred to
> > the ist?
> 
> I don't think so.  Anyone who can ptrace you from the start can
> corrupt you such that you leak rights even if some future action
> prevents new ptracers from attaching.
> 
> OTOH, it might be nice for something like an HTTPS server to be able
> to fork and shove its private key into the child, while preventing
> anyone from ptracing the child.  But doing this securely without help
> from someone with a different uid might be impossible anyway.
> 
> >
> > 2. would execve clear (and re-init) the list of creds?
> 
> Probably.  Thoughts?

Yeah it seems to me it should be re-initialized, with a cred added
to the list for every open fd.

> We could have a way to ask execve not to reinit the list.  Such a
> mechanism would have to require no_new_privs to prevent a
> straightforward attack on any setuid binary.

If we don't add a cred for every open fd, then I think we need this.  If
we do, then I'm not sure this makes sense.

> We's also want PR_SET_DUMPABLE or a new prctl to be able reset the
> list to contain just current-.cred, I think.

Yeah PR_SET_DUMPABLE should reset it, agreed.

-serge

  reply	other threads:[~2014-04-11 21:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5266BEA3.6020008@execulink.com>
     [not found] ` <20131022193718.GA18463@ac100>
     [not found]   ` <874n89rsoc.fsf@xmission.com>
2014-04-02 17:20     ` Serge Hallyn
2014-04-02 17:32       ` Serge E. Hallyn
2014-04-04 18:13         ` Andy Lutomirski
2014-04-04 18:30           ` Serge Hallyn
2014-04-04 19:03             ` Andy Lutomirski
2014-04-04 19:10               ` Serge Hallyn
2014-04-04 19:28                 ` Andy Lutomirski
2014-04-07 18:13                   ` Serge E. Hallyn
2014-04-10 19:50                     ` Andy Lutomirski
2014-04-11 21:52                       ` Serge E. Hallyn [this message]
2014-04-11 22:11                         ` Andy Lutomirski
2014-04-11 22:29                           ` Serge E. Hallyn
2014-04-11 22:32                             ` Andy Lutomirski
2014-04-11 22:46                               ` Serge E. Hallyn
2014-04-11 23:00                                 ` Andy Lutomirski

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=20140411215228.GA27354@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=lxc-devel@lists.linuxcontainers.org \
    --cc=sean.pajot@execulink.com \
    --cc=serge.hallyn@ubuntu.com \
    /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

all inboxes | Powered by JetHome®