Comment by oconnor663
14 days ago
> The trap is that get_user_by_name ends up loading shared libraries from the new root filesystem to resolve the username.
That's kind of horrifying. Is there a reliable list somewhere of all the functions that do that? Is that list considered stable?
Nope! But basically, expect anything that resolves usernames, or host names, to be done in the userspace by NSS.
It's by design, you see.
This is precisely why I don't link with glibc anymore.
musl has its own approach to this, it's called nscd
It would have avoided the "running code as root" part, but it would still allow an attacker to control the result of the function call.
I mean, the problem being solved here isn't exactly a bad problem to try to solve. You either permanently hard-code `/etc/passwd` as the user database, and `/etc/resolv.conf` as the source of DNS server information, or you allow these to be handled in a more complex way (thus allowing YellowPages, LDAP, or whatever you can imagine).
4 replies →