Skip to content

Use faccessat in traversed_secure_open#1477

Merged
squell merged 2 commits intotrifectatechfoundation:mainfrom
bjorn3:sudoedit_safety_checks
Mar 10, 2026
Merged

Use faccessat in traversed_secure_open#1477
squell merged 2 commits intotrifectatechfoundation:mainfrom
bjorn3:sudoedit_safety_checks

Conversation

@bjorn3
Copy link
Collaborator

@bjorn3 bjorn3 commented Feb 25, 2026

This performs all access checks a real open would do, not just the unix permission checks that we previously manually did. This way ACLs are taken into account as well as any mandatory access control that applies.

Also check if user is the owner. The owner of a file can modify file permissions and as such effectively has write permission, even if write permission is currently disabled in the file permissions.

Still needs a test that this actually fixes the ACL issue.

Fixes #1339

@bjorn3 bjorn3 requested a review from squell February 25, 2026 16:01
@bjorn3 bjorn3 force-pushed the sudoedit_safety_checks branch from afcedca to 6a9a6df Compare February 27, 2026 15:57
@squell
Copy link
Member

squell commented Mar 5, 2026

This is still marked as draft, maybe it can be marked as ready for review?

@squell squell added the C-operatingsystem Low-level glue layers label Mar 5, 2026
@squell squell added this to the Security hardening milestone Mar 5, 2026
@bjorn3 bjorn3 force-pushed the sudoedit_safety_checks branch from 6a9a6df to d79d9df Compare March 9, 2026 15:12
The owner of a file can modify file permissions and as such effectively
has write permission, even if write permission is currently disabled in
the file permissions. og-sudo also checks this.
@bjorn3 bjorn3 force-pushed the sudoedit_safety_checks branch from d79d9df to c29d64e Compare March 9, 2026 15:26
@bjorn3 bjorn3 marked this pull request as ready for review March 9, 2026 15:26
@bjorn3
Copy link
Collaborator Author

bjorn3 commented Mar 9, 2026

Both commits now contain a test for their respective change.

This performs all access checks a real open would do, not just the unix
permission checks that we previously manually did. This way ACLs are
taken into account as well as any mandatory access control that applies.
For testing we still use the old checks as faccessat can't be used to
test with arbitrary users when the unit tests run as regular user.
@bjorn3 bjorn3 force-pushed the sudoedit_safety_checks branch from c29d64e to e548465 Compare March 9, 2026 15:28
@bjorn3 bjorn3 requested a review from squell March 9, 2026 15:33
@squell squell merged commit b8039c0 into trifectatechfoundation:main Mar 10, 2026
20 checks passed
@bjorn3 bjorn3 deleted the sudoedit_safety_checks branch March 10, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-operatingsystem Low-level glue layers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACLs allow bypassing sudoedit's writability checks

2 participants