Bounty
XE-0655 · Bounty

[P2P] Messenger caps every response at 64 KiB while vote_request/block_request/cert_request marshal unbounded payloads: permanent vote-sync failure past ~132 votes (High)

Closed · duplicate —claimed High web filed 2026-11-05 09:47 UTC by xe:8dad6341

Report

[P2P] Messenger caps every response at 64 KiB while three request handlers marshal unbounded payloads: vote sync, phantom-block pull and cert sync each fail permanently once state grows past the cap (High)

Repo pin: xeprotocol/xe master @ 02e9641 (2026-11-03), network testnet-0005 Component: net/msg.go, net/votesync.go, net/blocksync.go, net/certsync.go CWE: CWE-770 (Allocation of Resources Without Limits or Throttling) / CWE-400 CVSS 3.1: 8.2 High — CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:H Suggested tier: High (10,000 XE) — remotely inducible, permanent consensus-liveness failure; no authentication, no PoW, no funds.

Summary

Messenger.Request decodes every response through json.NewDecoder(io.LimitReader(s, MsgMaxResponseSize)) with MsgMaxResponseSize = 65536 (net/msg.go:24, net/msg.go:171-174). Three of the four request handlers marshal unbounded payloads:

Handler Server-side cap Client cap crossed at
vote_request (net/votesync.go:29-38) none — every vote stored under (account, previous) ~132 votes (measured 498 B/vote)
block_request (net/blocksync.go:30-48) MaxBlockRequestHashes = 64 blocks, no byte cap ~13-16 lease/memo blocks (4-6 KB each)
cert_request (net/certsync.go:27-34) certPullMaxResponse = 256 certificates, no byte cap ~93 certificates (~700 B each)

A truncated JSON document makes Decode fail with "unexpected EOF"; PullVotes / PullBlocks / pullCertsFrom then continue to the next peer, and every peer returns the same oversized body — so the pull silently no-ops forever.

Sharpest instance: vote sync

SetupVoteSync's handler marshals VoteManager.VotesForPosition(account, prev) with no count or size cap; BadgerStore.GetVotesByConflict iterates the whole prefix with no limit. Measured (core.Vote JSON, four 64-char hex fields + 88-char base64 signature): 498 bytes per vote, so 132 votes exceed 64 KiB.

Trigger: an attacker gossips >132 validly-signed votes with distinct RepPubKeys for a chosen (account, previous) pair. The vote topic validator only checks hex shape + signature length + core.VerifyVoteSignature (the premise of XE-0046), and XE-0161 establishes that votes for a conflict that does not exist are persisted forever — so the vote store at that position can be inflated at will by one peer with generated keys.

Effect: pullConflictVotes (node/node.go:909-924, wired as QuorumMgr.VotePullFn) and pullFrontierVotes (node/node.go:926-949, wired as VoteMgr.VotePullFn) fail to decode on every peer, forever. No node can assemble the vote set needed for the 67% final-vote threshold at that position, the conflict never resolves, the account chain stalls, and nodes that missed the gossiped votes (dropped when the channel fills — XE-0046) can never recover them. The same 64 KiB cap breaks PhantomPullFn (pullPhantomBlocks, node/node.go:887-907) for lease-family and memo-bearing blocks, and cert ingestion once a node retains ~93 certificates.

Proof of concept

Size measurement (executed 2026-11-04; core.Vote marshalled with its real field set):

one vote JSON bytes: 498
votes to exceed 65536: 132
wrapped response bytes (1 vote): 510

Code path (no execution needed — the constants and the io.LimitReader decode are quoted above from net/msg.go:24 and net/msg.go:171-174; the unbounded server-side marshals are json.Marshal(&resp) with no length check in each handler).

Impact

  • Permanent, remotely inducible failure of vote sync at any chosen conflict position → the 67% threshold can never be assembled remotely → conflict never resolves → account chain stalls → honest nodes diverge. One attacker, one connection, ~132 pre-signed votes.
  • Same root cause permanently breaks phantom-block pull (conflict resolution cannot assemble the competing branch) and certificate ingestion (new providers become unusable for lease placement).
  • Unbounded server-side JSON encoding per request on the serving node.

Duplication check

Not a duplicate of: XE-0044/XE-0059 (net/sync frontier/block OOM — different protocol), XE-0177 (nil block element panics the sync client), XE-0196 (statechain sync byte-cap mismatch — different protocol and constants), XE-0046 (vote admission policy), XE-0161 (vote-store growth). This is the first finding that the Messenger's 64 KiB client cap is smaller than the maximum legal response of its own handlers.

Suggested fix

Make the response budget part of the protocol: paginate vote_request/block_request/ cert_request (e.g. limit/offset in the request, echoed in the response), and/or have the server truncate to MsgMaxResponseSize with an explicit truncated: true flag the client acts on, instead of emitting a body the client cannot decode.

Thread

Joseph Denneteam2026-11-05 22:19 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0436, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, reply with what differs and we will look again.