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

lib: allow safe_getenv to work for non-root users #1664

Merged
merged 1 commit into from May 2, 2022

Conversation

floppym
Copy link
Contributor

@floppym floppym commented Apr 26, 2022

This allows users to override settings like BLKID_FILE, as is done in
the e2fsprogs test suite.

Bug: https://bugs.gentoo.org/839825
Fixes: 035507c
Signed-off-by: Mike Gilbert floppym@gentoo.org

This allows users to override settings like BLKID_FILE, as is done in
the e2fsprogs test suite.

Bug: https://bugs.gentoo.org/839825
Fixes: 035507c
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
@karelzak
Copy link
Collaborator

We really don't want to allow non-root users to change security-sensitive settings (like devices identification, fstab path, ...).

@floppym
Copy link
Contributor Author

floppym commented Apr 27, 2022

Can you elaborate on how changing those settings in an unprivileged process poses a security risk? I've been pondering it myself, and I can't come up with a viable attack.

@floppym
Copy link
Contributor Author

floppym commented Apr 29, 2022

Also, the function calls secure_getenv when available, so that should cover the edge cases like Linux caps and suid/sgid bits.

@karelzak
Copy link
Collaborator

karelzak commented May 2, 2022

I read the code and patch again, and you're right.

Now sure why I have added the ruid != 0 in commit 035507c. It really seems too restrictive, what we need is to avoid suid situations. I guess the original idea was to avoid non-suid execution with some CAP_SYS_ADMIN or so, but I guess an auxiliary vector with AT_SECURE should be enough for us.

@karelzak karelzak merged commit 73d2425 into util-linux:master May 2, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants