From: Vasily Kulikov <segoon@openwall.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Containers <containers@lists.linux-foundation.org>,
"Serge E. Hallyn" <serge.hallyn@ubuntu.com>,
linux-kernel@vger.kernel.org,
kernel-hardening@lists.openwall.com
Subject: [kernel-hardening] Re: [PATCH/RFC] user_ns: fix missing limiting of user_ns counts
Date: Sat, 29 Dec 2012 09:22:34 +0400 [thread overview]
Message-ID: <20121229052234.GA4153@cachalot> (raw)
In-Reply-To: <87wqw15wqb.fsf@xmission.com>
On Fri, Dec 28, 2012 at 20:05 -0800, Eric W. Biederman wrote:
> Vasily Kulikov <segoon@openwall.com> writes:
>
> > Currently there is completely no limiting in number of user namespaces
> > created by unprivileged users. One can freely create thousands of
> > user_ns'es and exhaust kernel memory without even bumping in
> > RLIMIT_NPROC or similar.
>
> First for a proper sense of scale it will take roughly 14,000 to consume
> a megabyte. So it will take hundreds of millions of user namespaces to
> eat up all of kernel memory.
Yes, but you can freely create *any* number of nested userns by a loop:
for() {
unshare()
write to /proc/self/{u,g}id_map
}
> > The code needs several checks. First, noone should be able to create
> > user_ns of arbitrary depth. Besides kernel stack overflow one could
> > create too big depth to DoS processes belonging to other users by
> > forcing them to loop a long time in cap_capable called from some
> > ns_capable() (e.g. in case one does smth like "ls -R /proc").
>
> Where do you get a ns_capable call from "ls -R /proc" ?
E.g. if procfs is mounted with hidepid=2 then ls does
ptrace_may_access() check.
Thanks,
--
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments
next prev parent reply other threads:[~2012-12-29 5:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-28 17:56 [kernel-hardening] [PATCH/RFC] user_ns: fix missing limiting of user_ns counts Vasily Kulikov
2012-12-28 18:43 ` [kernel-hardening] " Al Viro
2012-12-28 19:04 ` Vasily Kulikov
2012-12-28 19:21 ` Al Viro
2012-12-29 4:05 ` Eric W. Biederman
2012-12-29 5:13 ` Al Viro
2012-12-29 5:22 ` Vasily Kulikov [this message]
2012-12-30 11:00 ` Vasily Kulikov
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=20121229052234.GA4153@cachalot \
--to=segoon@openwall.com \
--cc=containers@lists.linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).