News for hackers. Stuff that matters.
Re:Raru: Run as random user by pcwalton on Friday January 15, 2016 @09:13PM (#10913869)
Doesn't the Chromium sandbox already effectively do this without the suid bit by using CLONE_NEWUSER to enable use of setuid and then calling it?
Re:Raru: Run as random user by geofft on Friday January 15, 2016 @10:24PM (#10914074)
CLONE_NEWUSER doesn't actually change what your user is outside of that container/namespace. You get to map exactly one outside user to exactly one inside user. On systems where unprivileged users are permitted to call it, you can map your host user account to exactly one account inside the namespace, of which root is basically the only useful choice. Any interactions between the namespace and the rest of the system continue to treat you as your original UID.

The original implementation of CLONE_NEWUSER did actually convert users to vectors, or at least namespace-user tuples, which would have allowed unprivileged users to use the kernel UID mechanism for actual privilege separation. But that was dropped, I believe mostly because it was too much churn to the rest of the kernel and thus too risky. The current approach means that code that just thinks about root-namespace users continues to do the right thing.

The primary thing Chromium's sandbox seems to gets out of CLONE_NEWUSER is the ability to call chroot without shipping a setuid binary.

Re:Raru: Run as random user by pcwalton on Saturday January 16, 2016 @01:09AM (#10914469)
Oh, of course you're right. I implemented this stuff in gaol and completely forgot I had to stay as root inside the namespace because you can't setuid to unmapped users.

I stand (embarrassingly) corrected.

Re:Raru: Run as random user by sega01 on Friday January 15, 2016 @10:23PM (#10914072)
I've never heard of CLONE_NEWUSER before, it looks interesting. I don't think it's in FreeBSD.

My concern is that you can clearly browse and save files, so there is something that has access. Maybe it's much more secure than I thought, but I tend to be really skeptical towards programs of such length being perfectly secure.

Re:Raru: Run as random user by geofft on Friday January 15, 2016 @10:27PM (#10914086)
CLONE_NEWUSER / user namespaces is Linux-specific, yes. (Though see my other comment.)

I believe the Chromium sandbox mostly applies to things like renderers, where you can just hand it a buffer and a bunch of inputs and it'll effectively contain things like HTML parser bugs or libpng buffer overflows. I'm not totally sure if browsing itself is sandboxed.