hsrp, bluetooth, kerberos: fix three dissection crashes found by fuzzing - #5147
Open
nkbeast wants to merge 3 commits into
Open
hsrp, bluetooth, kerberos: fix three dissection crashes found by fuzzing#5147nkbeast wants to merge 3 commits into
nkbeast wants to merge 3 commits into
Conversation
added 3 commits
September 3, 2026 02:06
HSRP.guess_payload_class read self.underlayer.len unconditionally, so dissecting an HSRP packet that carries a trailing payload without an underlayer (e.g. HSRP(b'\x00\x01' + ...) or via layers that do not expose .len) raised AttributeError instead of dissecting the trailing bytes as the default payload class. Guard the underlayer access, keeping the HSRPmd5 selection unchanged when the underlayer is present and long enough. AI-Assisted: yes (Claude)
The six FieldListField entries were given the field classes (LEMACField, ByteField, ...) instead of instances, so any dissection of the event with num_response >= 1 raised 'Field.getfield() missing 1 required positional argument'. FieldListField expects an instance per its annotation (field: AnyField). Pass instances and cover a full inquiry result round trip in the test campaign. AI-Assisted: yes (Claude)
_InitialContextTokens[_parent.TOK_ID] raised KeyError for any TOK_ID outside the implemented set, aborting the dissection of a token with an attacker-supplied or future token identifier. Fall back to conf.raw_layer, consistent with the mysummary() fallback, keeping the body as raw bytes. Known TOK_IDs are unaffected. AI-Assisted: yes (Claude)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5147 +/- ##
=======================================
Coverage 80.80% 80.81%
=======================================
Files 390 390
Lines 96931 96931
=======================================
+ Hits 78329 78335 +6
+ Misses 18602 18596 -6
🚀 New features to boost your workflow:
|
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.
Three independent dissection crashes found by running random bytes through the default layers. Each commit is self-contained with its UTScapy test; no existing behavior changes.
1. hsrp
HSRP.guess_payload_classreadself.underlayer.lenunconditionally:Same class as #5089 (MQTTPublish). The HSRPmd5 selection is unchanged when the underlayer is present.
2. bluetooth
The six
FieldListFieldentries ofHCI_Event_Inquiry_Result_With_Rssiwere given field classes instead of instances, so the event could never be dissected withnum_response >= 1:Fixed by passing instances; the test campaign now round-trips a full inquiry result.
3. kerberos
KRB_InnerTokenindexed_InitialContextTokens[_parent.TOK_ID]directly, so any TOK_ID outside the implemented set aborted the dissection with aKeyError. Fall back toconf.raw_layer(consistent with the existingmysummary()fallback), keeping the body as raw bytes. Known TOK_IDs are unaffected.