Repository navigation
Conversation
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Author
|
Could a maintainer review this DNS compression-pointer validation fix? Please let me know if the fixed-header boundary handling needs changing or if additional malformed-packet cases are needed. Thanks. |
Author
|
Gentle follow-up: could a maintainer share whether this is still of interest and what the path to review looks like? Happy to make changes as needed. |
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.
Fixes #2371.
DNS.parseCompressedMessageconverts RFC 1035 4.1.4 compression pointers to body-relative offsets without validating the result. Pointers into the fixed 12-byte header produced a negative offset that Python negative indexing wrapped to the end of the buffer, silently parsing unrelated tail bytes as a name - no exception. Verified pre-fix on master @ 5648c37:parseCompressedMessage(b"\xc0\x00" + tail)returns(2, '')(empty name)parseCompressedMessage(b"\xc0\x07" + tail)returns(2, b'ab')(wrong name)The fix rejects negative body-relative pointer offsets with a clear
Invalid DNS compression pointerexception. Pointers past the end of the buffer were already rejected by the existing bounds check; cyclic pointers are already rejected by d96cef1. This closes only the header-bounds gap.Tests:
get_questions()). On master they fail with no exception raised (silent wrong names); with the fix they pass.tests/misc/test_dns.py4 passed + 3 subtests;tests/ImpactPacket+tests/dot11+tests/misc666 passed, 1 skipped.tests/dcerpc+tests/SMB_RPCcould not be validated in this environment (they need a target AD anddcetests.cfg); their failing test IDs were identical before and after this change (1461 both runs, diff empty).