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

safe procfs API #15

Closed
cyphar opened this issue Dec 29, 2019 · 1 comment · Fixed by #42
Closed

safe procfs API #15

cyphar opened this issue Dec 29, 2019 · 1 comment · Fixed by #42
Labels
api/cffi Related to the C-FFI API. api/rust Related to the Rust API.

Comments

@cyphar
Copy link
Member

cyphar commented Dec 29, 2019

This is something we really need to provide to avoid the attacks we are defending against in #7.

@cyphar cyphar added api/cffi Related to the C-FFI API. api/rust Related to the Rust API. labels Dec 29, 2019
@cyphar
Copy link
Member Author

cyphar commented Jul 5, 2024

With the new mount API, a privileged user can create a private handle with fsopen or open_tree. Since Linux 5.12 (torvalds/linux@ee2e3f50629f), open_tree-based anonymous mounts are completely race-free to use, though they were race free in principle since their inception. This lets us check for overmounts on symlinks with statx (this requires Linux 5.8).

We still can't be sure of the safety for other cases, but this lets us protect against the highest-risk case (a privileged process trying to operate on /proc). We could in principle create a new userns to gain the necessary privileges, but this is not guaranteed to always work, and forking in a multi-threaded process is quite dodgy.

cyphar/filepath-securejoin#13 has an implementation of this, though we would need to expand the features a bit to include re-opening and handling of the other magic-links like /proc/self/exe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api/cffi Related to the C-FFI API. api/rust Related to the Rust API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant