Skip to content

Conversation

@MegaManSec
Copy link
Contributor

Move runchroot prefixing ahead of open() so the fd and path refer to the same file. Fixes false digest matches or mismatches when fd == -1 and runchroot != NULL, since sudo_filedigest reads from fd while messages use the path. Also reduces path confusion noted by the symlink/.. comment.

Move runchroot prefixing ahead of open() so the fd and path refer to the same file.
Fixes false digest matches or mismatches when fd == -1 and runchroot != NULL,
since sudo_filedigest reads from fd while messages use the path.
Also reduces path confusion noted by the symlink/.. comment.
Copy link
Collaborator

@millert millert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This was a mis-merge when I added the runchroot path support back in.

@millert millert merged commit 122bf08 into sudo-project:main Oct 17, 2025
5 checks passed
@MegaManSec
Copy link
Contributor Author

out of interest, what is the consequence of this bug?

@millert
Copy link
Collaborator

millert commented Oct 17, 2025

If a sudoers rule specifies a hash for the command and there is a chroot dir specified (or the user is allowed to chroot to any dir), the hash would be computed based on the file outside the choot, not inside it. The chroot support is deprecated and scheduled to be removed in a future sudo release so I am not too concerned about this.

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.

2 participants