linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Josh Boyer <jwboyer@fedoraproject.org>
Cc: Andy Lutomirski <luto@amacapital.net>,
	"Serge E. Hallyn" <serge.hallyn@ubuntu.com>,
	Jann Horn <jann@thejh.net>, Roland McGrath <roland@hack.frob.com>,
	Oleg Nesterov <oleg@redhat.com>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"security\@kernel.org" <security@kernel.org>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] ptrace: being capable wrt a process requires mapped uids/gids
Date: Tue, 05 Jan 2016 19:17:19 -0600	[thread overview]
Message-ID: <87y4c3ld5s.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <CA+5PVA577SSG42i+C6oGw2c+dRcTS2oNgfehJ0-aqdPK5XZsjg@mail.gmail.com> (Josh Boyer's message of "Mon, 4 Jan 2016 10:03:45 -0500")

Josh Boyer <jwboyer@fedoraproject.org> writes:

> On Sat, Dec 26, 2015 at 9:03 PM, Andy Lutomirski <luto@amacapital.net> wrote:
>> On Sat, Dec 26, 2015 at 1:51 PM, Serge E. Hallyn
>> <serge.hallyn@ubuntu.com> wrote:
>>> On Sat, Dec 26, 2015 at 03:52:31AM +0100, Jann Horn wrote:
>>>> ptrace_has_cap() checks whether the current process should be
>>>> treated as having a certain capability for ptrace checks
>>>> against another process. Until now, this was equivalent to
>>>> has_ns_capability(current, target_ns, CAP_SYS_PTRACE).
>>>>
>>>> However, if a root-owned process wants to enter a user
>>>> namespace for some reason without knowing who owns it and
>>>> therefore can't change to the namespace owner's uid and gid
>>>> before entering, as soon as it has entered the namespace,
>>>> the namespace owner can attach to it via ptrace and thereby
>>>> gain access to its uid and gid.
>>>>
>>>> While it is possible for the entering process to switch to
>>>> the uid of a claimed namespace owner before entering,
>>>> causing the attempt to enter to fail if the claimed uid is
>>>> wrong, this doesn't solve the problem of determining an
>>>> appropriate gid.
>>>>
>>>> With this change, the entering process can first enter the
>>>> namespace and then safely inspect the namespace's
>>>> properties, e.g. through /proc/self/{uid_map,gid_map},
>>>> assuming that the namespace owner doesn't have access to
>>>> uid 0.
>>>>
>>>> Changed in v2: The caller needs to be capable in the
>>>> namespace into which tcred's uids/gids can be mapped.
>>>>
>>>> Signed-off-by: Jann Horn <jann@thejh.net>
>>>
>>> Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
>>
>> Acked-by: Andy Lutomirski <luto@kernel.org>
>>
>> Who's going to apply this?  Linus?  Eric?
>
> An Ack from Oleg would be nice too.  I'm guessing this got lost in the
> holidays but it has an assigned CVE now.  Would be good to get it in
> 4.4 final.

If people are going to go around and refuse to understand the problem
and assign CVEs to the kernel when they can't understand what is
necessary to safely write code I am inclined to nack the entire mess.

Whatever (if anything) that is calling setns in this problematic way is
the problem today.

This thread is about a feature request to make it easier to write secure
code not about a vulnerability in user namespaces.

Eric

  reply	other threads:[~2016-01-06  1:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12 20:12 [PATCH] ptrace: being capable wrt a process requires mapped uids/gids Jann Horn
2015-12-15  0:26 ` Andy Lutomirski
2015-12-17 18:59 ` Serge E. Hallyn
2015-12-26  1:10 ` Jann Horn
2015-12-26  2:52   ` Jann Horn
2015-12-26 21:17     ` Serge E. Hallyn
2015-12-26 21:27       ` Jann Horn
2015-12-26 21:49         ` Serge E. Hallyn
2015-12-26 21:51     ` Serge E. Hallyn
2015-12-27  2:03       ` Andy Lutomirski
2016-01-04 15:03         ` Josh Boyer
2016-01-06  1:17           ` Eric W. Biederman [this message]
2016-01-06  1:36             ` Andy Lutomirski
2016-01-06  2:04               ` Eric W. Biederman
2015-12-26 20:23   ` Serge E. Hallyn
2015-12-26 20:55     ` Jann Horn
2015-12-26 21:08       ` Serge E. Hallyn

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=87y4c3ld5s.fsf@x220.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=jann@thejh.net \
    --cc=jwboyer@fedoraproject.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    --cc=roland@hack.frob.com \
    --cc=security@kernel.org \
    --cc=serge.hallyn@canonical.com \
    --cc=serge.hallyn@ubuntu.com \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).