LWN.net Logo

The trouble with CAP_SYS_RAWIO

The trouble with CAP_SYS_RAWIO

Posted Mar 13, 2013 21:39 UTC (Wed) by ebiederm (subscriber, #35028)
Parent article: The trouble with CAP_SYS_RAWIO

Just for fun I will suggest changing capable from:

bool capable(int cap)
{
return ns_capable(&init_user_ns, cap);
}

to:

bool capable(int cap)
{
if (we_dont_trust_root)
return false;
return ns_capable(&init_user_ns, cap);
}

Which is equivalent to running userspace outside the initial user namespace, and trivially gives you and environment that has been audited to work for an untrusted root.

Just a few more things won't work that way but I would not mind a little help flushing out the things that we can trust less than fully privileged users with doing.

As for msrs. Make no mistake someone will eventually implement rdmsr(HALT_AND_CATCH_FIRE). So I can't believe even reading msrs is safe.


(Log in to post comments)

The trouble with CAP_SYS_RAWIO

Posted Mar 13, 2013 22:10 UTC (Wed) by spender (subscriber, #23067) [Link]

Get busy fixing this trivial local root vulnerability you introduced in 3.8 first:
http://stealth.openwall.net/xSports/clown-newuser.c

-Brad

The trouble with CAP_SYS_RAWIO

Posted Mar 14, 2013 3:12 UTC (Thu) by shlevy (subscriber, #87221) [Link]

Yikes!!! I had to disable fs.protected_hardlinks, but I can confirm this exploit works... Has this been reported to the appropriate channels?

The trouble with CAP_SYS_RAWIO

Posted Mar 14, 2013 6:51 UTC (Thu) by kees (subscriber, #27264) [Link]

Yes, and this specific issue has already been fixed:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linu...

The trouble with CAP_SYS_RAWIO

Posted Mar 14, 2013 11:33 UTC (Thu) by spender (subscriber, #23067) [Link]

Key phrase being "this specific issue". Several vulnerabilities have already been introduced by the addition of unprivileged user namespaces. It speaks to the trustworthiness of the code that these were found through casual inspection of a few lines of code and a very dumb fuzzer (trinity) -- it has not been exposed to serious security auditing. The author of the above exploit said it was the easiest he has ever written.

You should also know that the existing kernel exploit payloads for granting root privilege also break out of user namespaces without modification.

So the end result is opening up more attack surface to the most vulnerable part of the system, and soon on all distros you will have no choice but to be exposed to it. It's just broken security design.

-Brad

The trouble with CAP_SYS_RAWIO

Posted Mar 19, 2013 1:57 UTC (Tue) by wahern (subscriber, #37304) [Link]

"So the end result is opening up more attack surface to the most vulnerable part of the system, and soon on all distros you will have no choice but to be exposed to it."

Unfortunately, "less code, simpler code" is not one of the competing security paradigms in Linux Land.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds