Fix out-of-bounds reads in IcmpLayer getters on truncated packets - #2240
Open
Mrmaxmeier wants to merge 1 commit into
Open
Fix out-of-bounds reads in IcmpLayer getters on truncated packets#2240Mrmaxmeier wants to merge 1 commit into
Mrmaxmeier wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2240 +/- ##
==========================================
+ Coverage 82.71% 82.81% +0.09%
==========================================
Files 333 333
Lines 60367 60337 -30
Branches 12879 12509 -370
==========================================
+ Hits 49933 49967 +34
- Misses 9021 9498 +477
+ Partials 1413 872 -541
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Every get*Data() method checked only the ICMP message type before casting the layer buffer to the fixed-size structure that type implies, so a truncated capture produced an IcmpLayer shorter than the structure it claims to be and reading any field past the layer was out of bounds. Route those getters through a castMessageData() helper that requires the whole structure to be present, and tighten isDataValid() accordingly. Assisted-By: Claude Opus 5 <noreply@anthropic.com>
Mrmaxmeier
force-pushed
the
fix/icmp-truncated-layer-oob
branch
from
August 27, 2026 22:00
71f0a41 to
1316e19
Compare
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.
Hi,
we ran into an out-of-bounds read ASAN report with the
FuzzTarget.cppharness:The input is included in this PR under
Tests/Fuzzers/RegressionTests/regression_samples/crash-icmp-info-request-truncated.The
getX()methods inIcmpLayer.hcurrently only check the type field, and return a casted struct without verifying that the underlying buffer has enough data. This PR adjusts these getters to returnnullptrin the case of packets without enough data. It also adds a test that verifies this behaviour for various ICMP message types.Thanks!
Found by the CISPA Fandango team while triaging findings in oss-fuzz harnesses.