[bug] Fix RODC check in AuditUnconstrainedDelegations to compare against correct UAC flag (#21)#22
Open
p0dalirius wants to merge 1 commit into
Open
[bug] Fix RODC check in AuditUnconstrainedDelegations to compare against correct UAC flag (#21)#22p0dalirius wants to merge 1 commit into
p0dalirius wants to merge 1 commit into
Conversation
…rrect UAC flag (#21)
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.
Linked Issue
Closes #21
Root Cause
The RODC branch in
AuditUnconstrainedDelegationsmaskeduserAccountControlwithUAF_PARTIAL_SECRETS_ACCOUNT(the RODC flag) but then compared the result againstUAF_SERVER_TRUST_ACCOUNT(the DC flag) — a copy/paste mistake from the preceding DC branch. BecauseUAF_PARTIAL_SECRETS_ACCOUNT = 1<<27andUAF_SERVER_TRUST_ACCOUNT = 1<<13, the masked value is always either0or1<<27, so the equality check is unreachable and the RODC-specific audit message is never emitted.Fix Description
Change the right-hand side of the comparison to
UAF_PARTIAL_SECRETS_ACCOUNTso the branch actually detects RODCs. This is the idiomaticflag & X == Xpattern used elsewhere in the same file and in the modules' mode_* packages.How Verified
Static verification in the corrected code path at
core/mode_audit/UnconstrainedDelegations.go:63: for an RODC object (userAccountControl & (1<<27) != 0), the masked value equals1<<27 = UAF_PARTIAL_SECRETS_ACCOUNT, so the equality holds and the RODC warning is now reachable. For non-RODC objects, the mask yields0, the equality fails, and the control falls through to the genericSuspiciousbranch unchanged.Also verified by
go build ./...after the change.Test Coverage
None. The audit functions in this repository are not covered by unit tests at the time of the fix; adding one would require mocking the
ldap.Sessionsurface, which is out of scope for a one-line defect correction.Scope of Change
core/mode_audit/UnconstrainedDelegations.goRisk and Rollout
Trivial and local. Only affects the string emitted in the audit output for RODCs; no LDAP writes or state changes are involved.