Reject object ACE whose header exceeds its declared size - #47
Open
chiliec wants to merge 1 commit into
Open
Conversation
An object ACE advances the parse offset past the ObjectType and InheritedObjectType GUIDs (up to 28 bytes), bounded only against the input length, not the ACE's own declared AceSize. When AceSize is smaller than that header, data[offset:aceSize] has an inverted slice range and panics. Security descriptors reach ParseACE from attacker-controlled LDAP responses (see pkg/relay), so a crafted ACE crashes the process. Reject offset > aceSize before slicing the SID.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Problem
ParseACEvalidates the ACE's declaredAceSizeagainst the input length, then for an object ACE advancesoffsetpast theObjectTypeandInheritedObjectTypeGUIDs. Those advances are bounded only againstlen(data), never againstaceSizeitself:A crafted object ACE with a small
AceSize(e.g.12) butObjectFlagsdeclaring the type GUIDs present pushesoffsetto28, sodata[offset:aceSize]becomesdata[28:12]— an inverted slice range — and Go panics:Security descriptors reach
ParseACEviaParseSecurityDescriptor→ParseACLon attacker-controlled data:pkg/relay/ldap_attacks.goparses security descriptors returned by an LDAP server, so a malicious/compromised server can crash the tool.Reproduction
Added
TestParseACE_ObjectAceSizeBelowHeaderNoPanic, which builds an object ACE withAceSize = 12andOBJECT_TYPE_PRESENT. It panics on the current code and passes with the fix.Fix
Reject an object header that runs past the ACE's own declared size before slicing:
Validation