dot15d4: fix aux_sec_header incorrect parsing#4969
Open
T3pp31 wants to merge 3 commits intosecdev:masterfrom
Open
dot15d4: fix aux_sec_header incorrect parsing#4969T3pp31 wants to merge 3 commits intosecdev:masterfrom
T3pp31 wants to merge 3 commits intosecdev:masterfrom
Conversation
Fix two bugs preventing correct parsing of 802.15.4 frames with the security bit set: 1. Replace `is True` identity check with truthiness check in ConditionalField lambdas for Dot15d4Data, Dot15d4Beacon, and Dot15d4Cmd. In Python 3, `1 is True` is False because `is` checks object identity, not equality, so aux_sec_header was never parsed. 2. Add extract_padding() to Dot15d4AuxSecurityHeader so that remaining bytes after the header fields are returned to the parent packet instead of being consumed as payload.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4969 +/- ##
=======================================
Coverage 80.31% 80.31%
=======================================
Files 381 381
Lines 93630 93640 +10
=======================================
+ Hits 75202 75211 +9
- Misses 18428 18429 +1
🚀 New features to boost your workflow:
|
The encrypted beacon payload cannot be parsed as ZigBeeBeacon, which raises an exception when conf.debug_dissector is True (as in CI).
When sec_sc_seclevel >= 4 (ENC, ENC-MIC-*), the payload after aux_sec_header is encrypted and must not be passed to upper layer dissectors (SixLoWPAN, ZigBee, etc.). Add encrypted payload checks to guess_payload_class() in Dot15d4Data, Dot15d4Beacon, and Dot15d4Cmd.
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
Fixes #4928
ConditionalFieldlambdas inDot15d4Data,Dot15d4Beacon, andDot15d4Cmdthat usedis Trueidentity check instead of truthiness check. In Python 3,1 is Trueevaluates toFalsebecauseischecks object identity, soaux_sec_headerwas never parsed even whenfcf_security == 1.extract_padding()toDot15d4AuxSecurityHeaderso remaining bytes after the header fields are returned to the parent packet instead of being consumed as payload.Test plan
Dot15d4AuxSecurityHeadertrailing bytes becomePadding, notRawfcf_security=1correctly parsesaux_sec_header(issue reproduction case)aux_sec_headeraux_sec_headerfcf_security=0hasaux_sec_header is NonePASSED=65 FAILED=0)