Fuzzer 01 - Dispatcher, Packet: always check if we have enough 'len' before pulling bytes out of the raw frame - #3267
Open
h0lad wants to merge 2 commits into
Open
Conversation
h0lad
force-pushed
the
had/harden_length_matching
branch
3 times, most recently
from
August 21, 2026 18:46
fe8b5ce to
b7e9fe9
Compare
h0lad
marked this pull request as ready for review
August 21, 2026 18:48
h0lad
force-pushed
the
had/harden_length_matching
branch
from
August 21, 2026 18:53
b7e9fe9 to
a6a402f
Compare
added 2 commits
August 21, 2026 20:53
Every received frame is first turned into a 'Packet' struct by Dispatcher::tryParsePacket(). The frame is a length-prefixed byte string: [header][transport_codes(optional)][path_length][path][payload] The parser has to read the 'header' *first*, and only then does it know how many more bytes it is required to read. The bug is that it never checks that those bytes actually arrived.
Packet::readFrom() is a second, independent parser for the same wire format: [header][transport_codes(optional)][path_length][path][payload] It is used by the ESP-NOW bridge (src/helpers/bridges/ESPNowBridge.cpp) to turn a received blob back into a 'Packet'. It duplicates the parsing logic of Dispatcher::tryParsePacket() and has the same length-check problems, plus one more: the `path` read is not bounds-checked either.
h0lad
force-pushed
the
had/harden_length_matching
branch
from
August 21, 2026 18:53
a6a402f to
05da523
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.
I started playing around with a fuzzer. This is the first result.