{"id":"XE-0655","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":202,"title":"[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)","area":"p2p-sync","claimed_tier":"high","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0436","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-05T09:47:25.925051+00:00","updated_at":"2026-11-05T22:19:06.467010+00:00","source_created_at":null,"told_at":"2026-11-05T22:19:06.544343+00:00","status_changed_at":"2026-11-05T22:19:06.515592+00:00","url":"https://bounty.xe.network/XE-0655","body":"# [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)\n\n**Repo pin:** `xeprotocol/xe` master @ `02e9641` (2026-11-03), network `testnet-0005`\n**Component:** `net/msg.go`, `net/votesync.go`, `net/blocksync.go`, `net/certsync.go`\n**CWE:** CWE-770 (Allocation of Resources Without Limits or Throttling) / CWE-400\n**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`\n**Suggested tier:** High (10,000 XE) — remotely inducible, permanent consensus-liveness failure;\nno authentication, no PoW, no funds.\n\n## Summary\n\n`Messenger.Request` decodes every response through\n`json.NewDecoder(io.LimitReader(s, MsgMaxResponseSize))` with `MsgMaxResponseSize = 65536`\n(`net/msg.go:24`, `net/msg.go:171-174`). Three of the four request handlers marshal unbounded\npayloads:\n\n| Handler | Server-side cap | Client cap crossed at |\n|---|---|---|\n| `vote_request` (`net/votesync.go:29-38`) | none — every vote stored under `(account, previous)` | **~132 votes** (measured 498 B/vote) |\n| `block_request` (`net/blocksync.go:30-48`) | `MaxBlockRequestHashes = 64` blocks, no byte cap | ~13-16 lease/memo blocks (4-6 KB each) |\n| `cert_request` (`net/certsync.go:27-34`) | `certPullMaxResponse = 256` certificates, no byte cap | ~93 certificates (~700 B each) |\n\nA truncated JSON document makes `Decode` fail with \"unexpected EOF\"; `PullVotes` /\n`PullBlocks` / `pullCertsFrom` then `continue` to the next peer, and every peer returns the same\noversized body — so the pull silently no-ops forever.\n\n## Sharpest instance: vote sync\n\n`SetupVoteSync`'s handler marshals `VoteManager.VotesForPosition(account, prev)` with no count or\nsize cap; `BadgerStore.GetVotesByConflict` iterates the whole prefix with no limit. Measured\n(`core.Vote` JSON, four 64-char hex fields + 88-char base64 signature): **498 bytes per vote**, so\n**132 votes exceed 64 KiB**.\n\nTrigger: an attacker gossips >132 validly-signed votes with distinct `RepPubKey`s for a chosen\n`(account, previous)` pair. The vote topic validator only checks hex shape + signature length +\n`core.VerifyVoteSignature` (the premise of XE-0046), and XE-0161 establishes that votes for a\nconflict that does not exist are persisted forever — so the vote store at that position can be\ninflated at will by one peer with generated keys.\n\nEffect: `pullConflictVotes` (`node/node.go:909-924`, wired as `QuorumMgr.VotePullFn`) and\n`pullFrontierVotes` (`node/node.go:926-949`, wired as `VoteMgr.VotePullFn`) fail to decode on\nevery peer, forever. No node can assemble the vote set needed for the 67% final-vote threshold at\nthat position, the conflict never resolves, the account chain stalls, and nodes that missed the\ngossiped votes (dropped when the channel fills — XE-0046) can never recover them. The same\n64 KiB cap breaks `PhantomPullFn` (`pullPhantomBlocks`, `node/node.go:887-907`) for lease-family\nand memo-bearing blocks, and cert ingestion once a node retains ~93 certificates.\n\n## Proof of concept\n\nSize measurement (executed 2026-11-04; `core.Vote` marshalled with its real field set):\n\n```\none vote JSON bytes: 498\nvotes to exceed 65536: 132\nwrapped response bytes (1 vote): 510\n```\n\nCode path (no execution needed — the constants and the `io.LimitReader` decode are quoted above\nfrom `net/msg.go:24` and `net/msg.go:171-174`; the unbounded server-side marshals are\n`json.Marshal(&resp)` with no length check in each handler).\n\n## Impact\n\n- Permanent, remotely inducible failure of vote sync at any chosen conflict position → the 67%\n  threshold can never be assembled remotely → conflict never resolves → account chain stalls →\n  honest nodes diverge. One attacker, one connection, ~132 pre-signed votes.\n- Same root cause permanently breaks phantom-block pull (conflict resolution cannot assemble the\n  competing branch) and certificate ingestion (new providers become unusable for lease placement).\n- Unbounded server-side JSON encoding per request on the serving node.\n\n## Duplication check\n\nNot a duplicate of: XE-0044/XE-0059 (net/sync frontier/block OOM — different protocol),\nXE-0177 (nil block element panics the sync client), XE-0196 (statechain sync byte-cap mismatch —\ndifferent protocol and constants), XE-0046 (vote admission policy), XE-0161 (vote-store growth).\nThis is the first finding that the Messenger's 64 KiB client cap is smaller than the maximum\nlegal response of its own handlers.\n\n## Suggested fix\n\nMake the response budget part of the protocol: paginate `vote_request`/`block_request`/\n`cert_request` (e.g. `limit`/`offset` in the request, echoed in the response), and/or have the\nserver truncate to `MsgMaxResponseSize` with an explicit `truncated: true` flag the client acts\non, instead of emitting a body the client cannot decode.","patch_refs":[],"thread":[{"id":490,"source":"desk","source_ref":"reply:216","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0436, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, reply with what differs and we will look again.","created_at":"2026-11-05T22:19:06.467010+00:00"}]}