drsuapi: drop writeDSNAME structLen +2 cargo-cult#34
Merged
Conversation
MS-DRSR 4.1.4.1.1 specifies structLen as the exact byte size, rounded to a 4-byte boundary. Impacket carries a "+2" on top of the round-up that no part of the spec or wire trace justifies; AD is forgiving in practice but a stricter implementation could reject. Keep just the alignment round, drop the unexplained 2 extra bytes. This is the last open item from #32. Request-side change with no parser-side regression detection, so it was held out of #33 pending lab verification. Verified end-to-end against the GOAD lab (sevenkingdoms.local forest root + north.sevenkingdoms.local child domain): secretsdump --just-dc-ntlm exercises DsBind, DsDomainControllerInfo, DsCrackNames, and DsGetNCChanges in sequence and returns success on both domains. Output is byte-for-byte identical to the pre-fix dumps captured before removing the +2. Closes #32.
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.
Summary
Closes the final item from #32. MS-DRSR 4.1.4.1.1 specifies
structLenas the exact byte size of the DSNAME structure, rounded up to a 4-byte boundary. The previous code applied the round-up and then added 2 more bytes "per Impacket" — neither the spec nor the wire trace justifies the extra 2 bytes. AD is forgiving in practice but a stricter implementation could reject. With the+2in place the advertisedstructLenwas systematically congruent to 2 mod 4 (i.e. off the alignment) and 2 bytes larger than the actual serialized payload. The trailingwritten % 4round at the end ofwriteDSNAMEalready handles wire-side NDR alignment, so dropping the+2doesn't leave a gap.Verification
Item 3 was held out of #33 because it's request-side and there's no parser-side regression detection. Verified end-to-end against the GOAD lab:
sevenkingdoms.local, kingslanding @ 10.10.10.10) —secretsdump --just-dc-ntlmexercisesDsBind→DsDomainControllerInfo→DsCrackNames(viaGetDomainDN) →DsGetNCChanges. All four returned success; full account dump captured.north.sevenkingdoms.local, winterfell @ 10.10.10.11) — same four-RPC sequence, full dump captured.+2in place (the same dumps from drsuapi: tighten V6 parser allocations, fix RDN unescape, drop dead helper #33's lab pass).Test plan
go build ./...go vet ./pkg/dcerpc/drsuapi/...go test ./pkg/dcerpc/drsuapi/...secretsdump --just-dc-ntlmagainst forest root (sevenkingdoms.local)secretsdump --just-dc-ntlmagainst child domain (north.sevenkingdoms.local)Closes #32.