fix: P2P message deserialization and packet size hardening#82
Open
R0BC0D3R wants to merge 2 commits into
Open
Conversation
Ports several defensive checks from Monero v0.17.1.8-1.9 added in response to an active memory exhaustion attack on the network (Dec 2020). - Reject duplicate keys in epee binary deserialization - Reject unnamed sections on read, write, and insert - Track section objects and fields with separate counters and tighter limits (65536 objects, 262144 fields) to bound memory allocation - Add per-object limit check when deserializing section arrays Port of Monero commits f0b867b, cb296b3, 53106985, 0add7ec1.
… caps Connections start at a 256 KiB receive limit, upgraded to 100 MB once the P2P handshake completes. Per-command byte limits are registered on new connections (e.g. 4 KiB for PING, 128 MiB for block/tx responses). Transaction flooding is also restricted to fully handshaked peers.
Build Artifacts
10 succeeded, 0 failed | View workflow run |
ngeojiajun
approved these changes
May 16, 2026
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
Backports upstream Monero security mitigations for P2P denial-of-service
attack vectors. Changes are split into two areas:
Portable storage deserialization limits (epee)
m_fields) separate from the objectcount, capped at 262,144 fields per message
Levin protocol packet size controls
then upgraded to the full 100 MB cap
PING/support-flags, 64 KiB for handshake/timed-sync, 128 MiB for
block and transaction responses)
completed the handshake
Test plan