-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Improved security section in rustdoc for current_exe
#150828
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
base: main
Are you sure you want to change the base?
Conversation
|
cc @rust-lang/security |
This comment has been minimized.
This comment has been minimized.
current_exe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this: I don't think the Rust standard library is the right place to educate people about specific attacks. So keeping the documentation short and simply reminding people to not blindly trust the output seems good.
|
Since you've already taken a look, |
|
See also #150824 improving other parts of this function's rustdoc. |
This comment has been minimized.
This comment has been minimized.
e9c161c to
8fb7d64
Compare
A few improvements to the security section of the docs about
current_exe/proc/self/exe. On modern Linux this should normally require permission to write to the executable.I did some web research for "argv0 vulnerability" and similar terms and didn't find anything else we should be documenting here. (There are issues about argc=0 but those should be prevented by memory safety in Rust.)
I found what the link seemed to be pointing to in https://vulners.com/cve/CVE-2009-1894, which talks about confusing a setuid program by creating a hardlink to its exe. I think this is in very particular circumstances something people should still be concerned about: a setuid program on a machine with
fs.protected_hardlinks = 0. I don't think this justifies warning people not to use the function at all.cc @mgeisler