mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Kees Cook <keescook@google.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	Brad Spengler <spender@grsecurity.net>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: user ns: arbitrary module loading
Date: Sat, 2 Mar 2013 18:57:00 -0600	[thread overview]
Message-ID: <20130303005700.GA32213@austin.hallyn.com> (raw)
In-Reply-To: <CAGXu5jK7x+gFKgCN5=ZF+kSc4xSNbGtSERHCoOnCEgiJ1_wNGg@mail.gmail.com>

Quoting Kees Cook (keescook@google.com):
> The rearranging done for user ns has resulted in allowing arbitrary
> kernel module loading[1] (i.e. re-introducing a form of CVE-2011-1019)
> by what is assumed to be an unprivileged process.
> 
> At present, it does look to require at least CAP_SETUID along the way
> to set up the uidmap (but things like the setuid helper newuidmap
> might soon start providing such a thing by default).
> 
> It might be worth examining GRKERNSEC_MODHARDEN in grsecurity, which
> examines module symbols to verify that request_module() for a
> filesystem only loads a module that defines "register_filesystem"
> (among other things).
> 
> -Kees
> 
> [1] https://twitter.com/grsecurity/status/307473816672665600

So the concern is root in a child user namespace doing

	mount -t randomfs <...>

in which case do_new_mount() checks ns_capable(), not capable(),
before trying to load a module for randomfs.

As well as (secondly) the fact that there is no enforcement on
the format of the module names (i.e. fs-*).

Kees, from what I've seen the GRKERNSEC_MODHARDEN won't be acceptable.
At least Eric Paris is strongly against it.  But how about if we
add a check for 'current_user_ns() == &init_user_ns' at that place
instead?

Eric Biederman, do you have any objections to that?

thanks,
-serge

  reply	other threads:[~2013-03-03  0:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-02  1:22 Kees Cook
2013-03-03  0:57 ` Serge E. Hallyn [this message]
2013-03-03  1:18   ` Kees Cook
2013-03-03  3:56     ` Serge E. Hallyn
2013-03-03 10:14       ` [RFC][PATCH] fs: Limit sys_mount to only loading filesystem modules Eric W. Biederman
2013-03-03 15:29         ` Serge E. Hallyn
2013-03-03 18:30         ` Kees Cook
2013-03-03 17:48       ` user ns: arbitrary module loading Kees Cook
2013-03-04  8:29         ` Mathias Krause
2013-03-04 16:46           ` Kees Cook
2013-03-04 18:21             ` Eric W. Biederman
2013-03-04 18:41               ` Kees Cook
2013-03-03  4:12   ` Eric W. Biederman
2013-03-03 18:18     ` Kees Cook
2013-03-03 21:58       ` Eric W. Biederman
2013-03-04  2:35         ` Kees Cook
2013-03-04  3:54           ` Eric W. Biederman
2013-03-04  7:48           ` [PATCH 0/2] userns bug fixes for v3.9-rc2 for review Eric W. Biederman
2013-03-04  7:50             ` [PATCH 1/2] userns: Stop oopsing in key_change_session_keyring Eric W. Biederman
2013-03-04  7:51             ` [PATCH 2/2] fs: Limit sys_mount to only request filesystem modules Eric W. Biederman
2013-03-04 17:36               ` Vasily Kulikov
2013-03-04 18:36                 ` Eric W. Biederman
2013-03-05 19:06               ` Kay Sievers
2013-03-05 19:32                 ` Kees Cook
2013-03-05 23:24                 ` Eric W. Biederman

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=20130303005700.GA32213@austin.hallyn.com \
    --to=serge@hallyn.com \
    --cc=ebiederm@xmission.com \
    --cc=keescook@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge.hallyn@canonical.com \
    --cc=spender@grsecurity.net \
    --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

all inboxes | Powered by JetHome®