From: "Serge E. Hallyn" <serge.hallyn@ubuntu.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Linux Containers <containers@lists.linux-foundation.org>,
Alexander Larsson <alexl@redhat.com>,
Colin Walters <walters@verbum.org>,
Serge Hallyn <serge.hallyn@ubuntu.com>,
Stephane Graber <stgraber@ubuntu.com>,
Kees Cook <keescook@chromium.org>,
Seth Forshee <seth.forshee@canonical.com>
Subject: Re: Thoughts on tightening up user namespace creation
Date: Tue, 8 Mar 2016 00:06:57 -0600 [thread overview]
Message-ID: <20160308060657.GA3565@mail.hallyn.com> (raw)
In-Reply-To: <CALCETrU4+zTKABz1foEA=an3XYbe_UXxn_w9=1GjVzMe5DXXPw@mail.gmail.com>
On Mon, Mar 07, 2016 at 09:15:25PM -0800, Andy Lutomirski wrote:
> Hi all-
>
> There are several users and distros that are nervous about user
> namespaces from an attack surface point of view.
>
> - RHEL and Arch have userns disabled.
>
> - Ubuntu requires CAP_SYS_ADMIN
No, it does not. It has temporarily re-added a sysctl which can enable
that behavior, but it's not set by default. The reason for providing it
is not a distrust of user namespaces in general, but because we're enabling
some bleeding edge patches which haven't been accepted upstream yet. Once
they're accepted upstream I expect that patch to be dropped again, unless
it has gone upstream.
Debian does afaik still have a version of a patch I'd originally written
before user namespaces were upstream which defaulted unprivileged userns
cloning to off. Did you mean Debian here?
> - Kees periodically proposes to upstream some sysctl to control
> userns creation.
>
> I think there are three main types of concerns. First, there might be
> some as-yet-unknown semantic issues that would allow privilege
> escalation by users who create user namespaces and then confuse
> something else in the system. Second, enabling user namespaces
> exposes a lot of attack surface to unprivileged users. Third,
> allowing tasks to create user namespaces exposes the kernel to various
> resource exhaustion attacks that wouldn't be possible otherwise.
>
> Since I doubt we'll ever fully address the attack surface issue at
> least, would it make sense to try to come up with an upstreamable way
> to limit who can create new user namespaces and/or do various
> dangerous things with them?
>
> I'll divide the rest of the email into the "what" and the "who".
>
> +++ What does the privilege of creating a user namespace entail? +++
>
> This could be an all-or-nothing thing. It would certainly be possible
> for appropriately privileged tasks to be able to unshare namespaces
> and use their facilities exactly like any task can in a current
> user-ns-enabled kernel and for other tasks to be unable to unshare
> anything.
>
> Finer gradations are, in principle, possible. For example, it could
> be possible for a given task to unshare its userns but to have limited
> caps inside or to be unable to unshare certain other namespaces. For
> example, maybe a task could unshare userns and mount ns but not net
> ns. I don't think this would be particularly useful.
>
> It might be more interesting to allow a task to unshare all
> namespaces, hold all capabilities in them, but to still be unable to
> use certain privileged facilities. For example, maybe denying
> administrative control over iptables, creation of exotic network
> interface types, or similar would make sense. I don't know how we'd
> specify this type of constraint.
>
> +++ Who can create user namespaces (possibly with restrictions)? +++
>
> I can think of a few formulations.
>
> A simpler approach would be to add a per-namespace setting listing
> users and/or groups that can unshare their userns. A userns starts
> out allowing everyone to unshare userns, and anyone with CAP_SYS_ADMIN
> can change the setting.
>
> A fancier approach would be to have an fd that represents the right to
> unshare your userns. Some privilege broker could give out those fds
> to apps that need them and meet whatever criteria are set. If you try
> to unshare your userns without the fd, it falls back to some simpler
> policy.
>
> I think I prefer the simpler one. It's simple, and I haven't come up
> with a concrete problem with it yet.
>
>
>
>
> Thoughts?
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers
next prev parent reply other threads:[~2016-03-08 6:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 5:15 Thoughts on tightening up user namespace creation Andy Lutomirski
2016-03-08 6:06 ` Serge E. Hallyn [this message]
2016-03-08 18:31 ` Andy Lutomirski
2016-03-08 22:41 ` Serge E. Hallyn
2016-03-08 10:05 ` Alexander Larsson
2016-03-08 16:31 ` Eric W. Biederman
2016-03-09 18:14 ` Kees Cook
2016-03-09 18:51 ` Colin Walters
2016-03-09 19:04 ` Austin S. Hemmelgarn
2016-03-09 19:21 ` Serge E. Hallyn
2016-03-09 19:25 ` Kees Cook
2016-03-09 19:07 ` Serge E. Hallyn
2016-03-09 19:12 ` 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=20160308060657.GA3565@mail.hallyn.com \
--to=serge.hallyn@ubuntu.com \
--cc=alexl@redhat.com \
--cc=containers@lists.linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=seth.forshee@canonical.com \
--cc=stgraber@ubuntu.com \
--cc=walters@verbum.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).