Re: fs: sandboxed process brings host down

From: Kees Cook
Date: Fri Jan 22 2016 - 16:46:39 EST


On Fri, Jan 22, 2016 at 1:21 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> On Fri, Jan 22, 2016 at 10:06:14PM +0100, Dmitry Vyukov wrote:
>> Hello,
>>
>> While running syzkaller fuzzer I hit the following problem. Supervisor
>> process sandboxes worker processes that do random activities with
>> CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWPID | CLONE_NEWUTS |
>> CLONE_NEWNET | CLONE_NEWIPC | CLONE_IO, setrlimit, chroot, etc.
>> Because of that worker process gains ability to bring whole machine
>> down (does not happen without the sandbox).
>
> AFAICS, what you are doing is essentially mount --rbind / / in infinite
> loop in luserns. Which ends up eating all memory. There's any number
> of ways to do the same. We can play whack-a-mole with them until the
> kernel is completely ossified with accounting code of different sorts.
> Or one can disable userns and be done with that.

I think it's time for a runtime tunable to disable userns. For all the
distro users that are forced to run with kernels built with
CONFIG_USER_NS, there's no way for them to escape these USER_NS flaws
when they don't use the feature.

-Kees

--
Kees Cook
Chrome OS & Brillo Security