Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

userspec.c allows "." for user/group separators; causes weirdness with tools like chown #12

Open
ngie-eign opened this issue Aug 18, 2021 · 0 comments

Comments

@ngie-eign
Copy link

ngie-eign commented Aug 18, 2021

Usernames on multiple operating systems (especially ones which are AD-joined) support "." in [long] usernames. Unfortunately, userspec.c treats "." like a user/group separator for unclear legacy reasons. This is very problematic behavior that can cause very unportable unexpected results in consumers which leverage the API, like chown(1).

Say, for instance, someone introduced a user, root.wheel, then tried to chown the file as root.wheel -- it would actually chown the file to user=root, group=wheel, which is unexpected, instead of chowning it to a user named root.wheel.

If an attacker was aware of this caveat and there was a program run as root or had superuser permissions to set file ownership and the system had a user named root.wheel, which sanitized the input to ensure that the user first existed before passing the string to chown(1), files could be setuid to allow permissions to root:wheel, and thus could be abused by the attackers to run the intercepted program with superuser privileges.

Ref: 693dd1d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant