fix(sandbox): replace user.uid with user.loginuid in SUID privilege escalation rules#356
Open
KrakoX wants to merge 1 commit intofalcosecurity:mainfrom
Open
fix(sandbox): replace user.uid with user.loginuid in SUID privilege escalation rules#356KrakoX wants to merge 1 commit intofalcosecurity:mainfrom
KrakoX wants to merge 1 commit intofalcosecurity:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: KrakoX The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @KrakoX! It looks like this is your first PR to falcosecurity/rules 🎉 |
…scalation rules sudo and pkexec are SUID root binaries. Falco's user.uid reflects the effective UID, which is always 0 for SUID binaries regardless of who invokes them. The condition user.uid != 0 is therefore always false and the rules never fire. Replace with user.loginuid != 0. The loginuid (kernel audit UID) is set by PAM at session login and preserved through SUID execution. This fires for non-root users on host (loginuid > 0), is silent for root on host (loginuid = 0), and fires for all container processes (loginuid = -1, no PAM session) — covering the primary threat surface. Affects: - Sudo Potential Privilege Escalation (CVE-2021-3156) - Polkit Local Privilege Escalation Vulnerability (CVE-2021-4034) Signed-off-by: KrakoX <krakox.entryway360@passmail.net>
eedca76 to
589eafa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area rules
Proposed rule maturity level
/area maturity-sandbox
What this PR does / why we need it:
sudoandpkexecare SUID root binaries. Falco'suser.uidfield reflects the effective UID, which the kernel sets to 0 when any user executes a SUID binary. The conditionuser.uid != 0is therefore permanently false for these binaries.Fix: replace
user.uid != 0withuser.loginuid != 0.user.loginuidis the Linux kernel audit UID (loginuid), set by PAM at session login and preserved through SUID execution. It correctly identifies the actual caller:Verified empirically on Ubuntu 22.04 and 24.04 / kernel 6.8.0 / Falco 0.43.0 via debug rule capturing live
user.uidanduser.loginuidfield values during pkexec and sudo executions.