Fix unusable SDDL ACE types TL and FL by adding ACE types 0x14 and 0x15 (Fixes #134) - #137
Merged
Conversation
…15 (Fixes #134) SDDL_PROCESS_TRUST_LABEL ("TL") and SDDL_ACCESS_FILTER ("FL") were declared but their SDDLToACETypeMap entries were commented out, because the referenced constants ACE_TYPE_SYSTEM_PROCESS_TRUST_LABEL and ACE_TYPE_SYSTEM_ACCESS_FILTER did not exist: the ACE type constant block stopped at 0x13. Both SDDL tags were therefore dead code and any descriptor using them was rejected with "unknown ACE type". Add the two constants (0x14 and 0x15 per winnt.h, neither listed in MS-DTYP 2.4.4.1), their human-readable names, and enable the two SDDL map entries. Enabling the SDDL mapping alone would have been a half fix: the Unmarshal switch errors on an unhandled type via its default branch, so the binary path would still have failed. Both ACE types carry an ACCESS_MASK followed by a SID, the same wire shape as SYSTEM_MANDATORY_LABEL and SYSTEM_SCOPED_POLICY_ID, so they are grouped onto the existing SYSTEM_SCOPED_POLICY_ID case in all three type switches (Unmarshal, Marshal and DescribeList) rather than duplicating the bodies.
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 #134Root Cause
SDDL_PROCESS_TRUST_LABEL("TL") andSDDL_ACCESS_FILTER("FL") were declared as SDDL constants, but theirSDDLToACETypeMapentries were commented out because they referencedACE_TYPE_SYSTEM_PROCESS_TRUST_LABELandACE_TYPE_SYSTEM_ACCESS_FILTER, identifiers that did not exist. The ACE type constant block inace/acetypestops atACE_TYPE_SYSTEM_SCOPED_POLICY_ID = 0x13, so there was nothing for the map to point at and the entries were commented rather than completed. Both SDDL tags were therefore dead code, and any descriptor using one was rejected outright.The underlying reason the constants are absent is that MS-DTYP 2.4.4.1's AceType table does not list
0x14or0x15; they are defined only inwinnt.h. A constant block transcribed from the spec stops exactly where this one does.Fix Description
Three coordinated changes:
ace/acetypegainsACE_TYPE_SYSTEM_PROCESS_TRUST_LABEL = 0x14andACE_TYPE_SYSTEM_ACCESS_FILTER = 0x15, with comments noting they come fromwinnt.hrather than MS-DTYP, plus their entries in the human-readable name map.SDDLToACETypeMapentries are uncommented and now resolve.Point 3 is the part that makes this a real fix rather than a cosmetic one. Enabling the SDDL mapping alone would still have failed on the binary path, because the
Unmarshalswitch'sdefaultbranch returnsunknown ACE type: %d. Both structures carry anACCESS_MASKfollowed by a SID — the same wire shape asSYSTEM_MANDATORY_LABELandSYSTEM_SCOPED_POLICY_ID— so rather than duplicating those case bodies three times, the two new types are grouped onto the existingACE_TYPE_SYSTEM_SCOPED_POLICY_IDcase label in all three switches (Unmarshal,Marshal,DescribeList). That keeps the diff to a case label per switch and guarantees the three paths cannot drift apart for these types.How Verified
Runtime, before the fix — verified with a standalone program, since a test referencing the new constants cannot compile against the pre-fix tree:
The
MLcontrol shows the SACL path itself was already sound; only these two types were unreachable.Runtime, after the fix — full SDDL → binary → SDDL round-trip:
Repository suite —
go test ./...green.Test Coverage
Added — in
securitydescriptor/NtSecurityDescriptor_conditional_test.go:TestACEType_TL_FL_RoundTrip— parsesTLandFLfrom SDDL, asserts the resulting ACE type byte, then marshals and unmarshals and asserts the SDDL round-trips byte-identically. Covers a masked variant too. This is the test that would have caught the half fix: it exercisesMarshal/Unmarshal, not just the SDDL map.TestACEType_TL_FL_Names— pins the constants to0x14/0x15and asserts both resolve to a non-empty name.Note on regression value: against the pre-fix tree these tests fail to compile rather than fail at runtime, because the constants they reference are part of the fix. The pre-fix behaviour was therefore verified with the standalone program quoted above rather than by running these tests.
Scope of Change
ace/acetype/AccessControlEntryType.go,sddl/ace/acetype/AccessControlEntryType.go,ace/AccessControlEntry.go,securitydescriptor/NtSecurityDescriptor_conditional_test.goRisk and Rollout
Additive: input that already parsed is unaffected, and input that previously errored may now succeed. The only shared code touched is three case labels, and the bodies they join are unchanged. Safe to merge without staged rollout.
Notes
Same defect class as #129, which added the missing
ZDSDDL mapping — an SDDL tag with no path to an ACE type constant.Two observations left deliberately out of scope:
DescribeListswitch,case acetype.ACE_TYPE_SYSTEM_ALARM_CALLBACK_OBJECT:has an empty body immediately abovecase acetype.ACE_TYPE_SYSTEM_MANDATORY_LABEL:. Go does not fall through, so that ACE type describes nothing. Pre-existing and unrelated; worth its own issue if intended to be grouped.securitydescriptor/NtSecurityDescriptor_test.goandsddl/sddl_functions_test.goare flagged bygofmt -lonmainalready and are untouched here.Filed alongside this from the same investigation: #133 (SDDL SID alias table incomplete, fixed in #136) and #135 (undocumented conditional-expression tokens
0xfc/@TOKEN.and0xa3/&).