2.6.33 merge window part 1
2.6.33 merge window part 1
Posted Dec 10, 2009 9:37 UTC (Thu) by wahern (subscriber, #37304)Parent article: 2.6.33 merge window part 1
For example, my portable arc4random--which uses sysctl(CTL_KERN, KERN_RANDOM, RANDOM_UUID)--will break. Requiring people to seed before the chroot happens, or requiring users to create device files in the chroot tree doesn't help; those things aren't required on other platforms.
One plus is that there'd be less kernel exposure in a chroot without either /proc or sysctl. And certainly in general removing code is good, though /proc has historically been riddled with kernel exploits; far more than sysctl ever produced. Indeed, the mere existence of /proc outside the chroot has its own problems, like exposing file descriptors--pipes, socketpairs--that would otherwise be unaddressable by other processes. Thus one of the strongest security characteristics--using descriptors as ad hoc "capability" tokens--is totally broken. File permissions aren't nearly as strong a security mechanism as the inability to reference the object.
Posted Dec 10, 2009 9:55 UTC (Thu)
by johill (subscriber, #25196)
[Link] (1 responses)
"He then adds back a new wrapper which emulates the sysctl() ABI by way of /proc/sys. So any applications using sysctl() should continue to work, but the code dedicated to making it work is much reduced from what was there before."
I don't think that wrapper actually requires it to be mounted.
Posted Dec 10, 2009 16:20 UTC (Thu)
by ebiederm (subscriber, #35028)
[Link]
Posted Dec 10, 2009 16:37 UTC (Thu)
by ebiederm (subscriber, #35028)
[Link] (3 responses)
A few comments.
sysctl was absolutely riddled with exploitable code, when I started working on it, and a hole was closed just a few weeks ago. It just happens that no one not even those who exploit kernel issues for the fame looked at the implementation details of sysctl.
I will agree that the sysctl format of only exporting simple integer and string values is much harder to exploit, and as such is a good idea.
As for the file descriptors they are not exposed to other users. The permissions on /proc/<pid>/fd/ are limited. Except for one esoteric corner case you can't do anything more with the file descriptors in proc than you could by attaching a debugger. Using file descriptors as ad hoc "capability" tokens is not broken in any way that I am aware of.
Posted Dec 10, 2009 19:45 UTC (Thu)
by spender (guest, #23067)
[Link]
-Brad
Posted Dec 10, 2009 20:29 UTC (Thu)
by wahern (subscriber, #37304)
[Link]
Though, I'll admit then that Linux wouldn't be the first to break this behavior (if indeed it did, which it hasn't yet). I'll have to fix my apps to stir before any chroot.
As for /proc/$$/fd: take Apache as an example. Site A can access descriptors--specifically anonymous pipes--of site B. That the process for site A could theoretically attach itself to site B is beside the point. Typically both processes are running virtual machines and/or interpreters where debugging interfaces aren't available. Regular file routines, however, are usually available. Breaking out of a VM is significantly more difficult than coaxing a script to eval code.
Requiring a different process user for every site is impracticable, unless perhaps the kernel could provide ephemeral UIDs. Anyhow, you can drop ptrace capabilities, yet because of the growing necessity of /proc it's increasingly just as impracticable to not have /proc mounted.
With the rise of "cloud computing" (née SaS, née time-sharing systems), the notion that privileges are necessarily tied to persistent objects or system-wide credentials is short-sighted. The operating system should provide certain primitives and behaviors that allow applications to create ad hoc privilege systems enforceable by the hardware, e.g. the MMU. Solutions like SELinux, or any other system-wide _explicit_ access control, miss the mark entirely in almost every way imaginable.
Posted Dec 19, 2009 10:48 UTC (Sat)
by jengelh (guest, #33263)
[Link]
And for where it matters, glibc could emulate sysctl() by going to /proc/sys instead.
2.6.33 merge window part 1
2.6.33 merge window part 1
sysctl(2) support to work.
2.6.33 merge window part 1
arc4random prefers to use /dev/urandom and tries that first so even
inside a nicely setup chroot it will work.
2.6.33 merge window part 1
What's the CVE for the vulnerability that was fixed?
2.6.33 merge window part 1
2.6.33 merge window part 1