| ▲ | geocar 3 hours ago | |||||||
> The root cause of some of the bugs seems to be the opaque nature of some of the Unix API. Seems and smells is weasel words. The root cause is not thinking: Why is root chrooting into a directory they do not control? Whatever you chroot into is under control of whoever made that chroot, and if you cannot understand this you have no business using chroot() > To me such a get_user_by_name function is like a booby trap > I'd say, either split getting the user data and loading any shared libraries in two separate functions, or somehow make it clear in the function name what it is doing. You'd probably still be in the trap: there's usually very little difference between writing to newroot/etc/passwd and newroot/usr/lib/x86_64-linux-gnu/libnss_compat.so or newroot/bin/sh or anything else. So I think there's no reason for /usr/sbin/chroot look up the user id in the first place (toybox chroot doesn't!), so I think the bug was doing anything at all. | ||||||||
| ▲ | Joker_vD 2 hours ago | parent [-] | |||||||
> The root cause is not thinking: Why is root chrooting into a directory they do not control? Because you can't call chroot(2) unless you're root. And "control a directory" is weasel words; root technically controls everything in one sense of the word. It can also gain full control (in a slightly different sense of the word) over a directory: kill every single process that's owned by the owner of that directory, then don't setuid into that user in this process and in any other process that the root currently executes, or will execute, until you're done with this directory. But that's just not useful for actual use, isn't it? Secure things should be simple to do, and potentially unsafe things should be possible. | ||||||||
| ||||||||