From: Kees Cook <kees.cook@canonical.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Richard Weinberger <richard@nod.at>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
serge@hallyn.com, eparis@redhat.com, jmorris@namei.org,
eugeneteo@kernel.org, drosenberg@vsecurity.com
Subject: Re: [PATCH] [RFC] Make it easier to harden /proc/
Date: Wed, 16 Mar 2011 23:41:36 -0700 [thread overview]
Message-ID: <20110317064136.GD5466@outflux.net> (raw)
In-Reply-To: <m1lj0eepe4.fsf@fess.ebiederm.org>
On Wed, Mar 16, 2011 at 02:17:39PM -0700, Eric W. Biederman wrote:
> Richard Weinberger <richard@nod.at> writes:
> 2> Am Mittwoch 16 März 2011, 21:45:45 schrieb Arnd Bergmann:
> >> On Wednesday 16 March 2011 21:08:16 Richard Weinberger wrote:
> >> > Am Mittwoch 16 März 2011, 20:55:49 schrieb Kees Cook:
> >> > > On Wed, Mar 16, 2011 at 08:31:47PM +0100, Richard Weinberger wrote:
> >> > > > When containers like LXC are used a unprivileged and jailed
> >> > > > root user can still write to critical files in /proc/.
> >> > > > E.g: /proc/sys/kernel/{sysrq, panic, panic_on_oops, ... }
> >> > > >
> >> > > > This new restricted attribute makes it possible to protect such
> >> > > > files. When restricted is set to true root needs CAP_SYS_ADMIN
> >> > > > to into the file.
> >> > >
> >> > > I was thinking about this too. I'd prefer more fine-grained control
> >> > > in this area, since some sysctl entries aren't strictly controlled by
> >> > > CAP_SYS_ADMIN (e.g. mmap_min_addr is already checking CAP_SYS_RAWIO).
> >> > >
> >> > > How about this instead?
> >> >
> >> > Good Idea.
> >> > May we should also consider a per-directory restriction.
> >> > Every file in /proc/sys/{kernel/, vm/, fs/, dev/} needs a protection.
> >> > It would be much easier to set the protection on the parent directory
> >> > instead of protecting file by file...
> >>
> >> How does this interact with the per-namespace sysctls that Eric
> >> Biederman added a few years ago?
> >
> > Do you mean CONFIG_{UTS, UPC, USER, NET,}_NS?
> >
> >> I had expected that any dangerous sysctl would not be visible in
> >> an unpriviledge container anyway.
> >
> > No way.
> > That's why it's currently a very good idea to mount /proc/ read-only
> > into a container.
>
> However it is in the architecture. The problem is that the user
> namespace is not finished. Once finished even root with all caps in a
> container will have no more permissions than the unprivileged user that
> created the user namespace.
>
> Essentially the change is to make permissions checks become a comparison
> of the tuple (user_ns, uid) instead of just comparisons by uid. If we
> want to fix permission problems with proc and containers please let's
> focus on the completing the user namespace.
I actually think these are not mutually exclusive. Right now /proc/sys is
filled with ways to gain caps as a reduced-privilege uid 0 user. I don't
think containers are the only place where we want to be limiting /proc/sys.
(For example, core_pattern and modprobe entries can both be written by
root, regardless of cap, which can be directed to run arbitrary commands
with full caps. And yes, that's also being fixed separately, it's just an
example.)
I'd still like to see the sysctl table expanded to include caps to test.
-Kees
--
Kees Cook
Ubuntu Security Team
next prev parent reply other threads:[~2011-03-17 6:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-16 19:31 [PATCH] [RFC] Make it easier to harden /proc/ Richard Weinberger
2011-03-16 19:55 ` Kees Cook
2011-03-16 20:08 ` Richard Weinberger
2011-03-16 20:45 ` Arnd Bergmann
2011-03-16 20:52 ` Richard Weinberger
2011-03-16 21:03 ` Arnd Bergmann
2011-03-16 21:04 ` Alexey Dobriyan
2011-03-16 21:07 ` Richard Weinberger
2011-03-16 21:15 ` Alexey Dobriyan
2011-03-17 10:14 ` Miquel van Smoorenburg
2011-03-17 10:57 ` Richard Weinberger
2011-03-16 21:17 ` Eric W. Biederman
2011-03-16 21:23 ` Richard Weinberger
2011-03-16 21:27 ` Eric W. Biederman
2011-03-17 6:41 ` Kees Cook [this message]
2011-03-17 7:30 ` Richard Weinberger
2011-03-16 21:19 ` Alexey Dobriyan
2011-03-17 16:51 ` Eric W. Biederman
2011-03-19 10:43 ` Richard Weinberger
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=20110317064136.GD5466@outflux.net \
--to=kees.cook@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=drosenberg@vsecurity.com \
--cc=ebiederm@xmission.com \
--cc=eparis@redhat.com \
--cc=eugeneteo@kernel.org \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@nod.at \
--cc=serge@hallyn.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