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

ucm: fix TOCTOU race condition #367

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szsam
Copy link
Contributor

@szsam szsam commented Nov 16, 2023

Separately checking the state of a file before operating on it may allow an attacker to modify the file between the two operations. Fix by calling readlink first. If that fails, then path should not be a symbolic link and we call open() followed by fstat(). open() with O_NOFOLLOW will return an error if the file is a symlink.

Separately checking the state of a file before operating on it may allow
an attacker to modify the file between the two operations.
Fix by calling readlink first. If that fails, then path should not be a
symbolic link and we call open() followed by fstat(). open() with
O_NOFOLLOW will return an error if the file is a symlink.

Signed-off-by: Mingjie Shen <[email protected]>
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.

1 participant