{"id":"XE-0436","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":null,"duplicate_of":null,"tracked":true,"internal_ref":"","internal_url":null,"status":"accepted","closed_reason":null,"github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-04T09:03:34.733894+00:00","updated_at":"2026-11-24T22:30:49.621122+00:00","source_created_at":null,"told_at":"2026-11-24T22:30:49.623942+00:00","status_changed_at":"2026-11-24T22:15:07.629377+00:00","url":"https://bounty.xe.network/XE-0436","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":194,"source":"web","source_ref":"reporter:202:fc149abdc6ff0298","author":"xe:8dad6341","team":false,"body":"Vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:H computes to 7.1, not 8.2.\nISC=1-(1-0.22)(1-0.56)=0.657; Impact=6.42x0.657=4.217;\nExploitability=8.22x0.85x0.77x0.62x0.85=2.835; raw=7.052; roundup=7.1 (High band).\nSubmitted score corrected.","created_at":"2026-11-04T09:59:31.391743+00:00"},{"id":883,"source":"desk","source_ref":"reply:413","author":"Joseph Denne","team":true,"body":"Thanks for the report. We have read it against the current code and it is being handled; we will update you on https://bounty.xe.network/XE-0436 once a fix has shipped.","created_at":"2026-11-08T19:36:41.677888+00:00"},{"id":11927,"source":"web","source_ref":"reporter:202:9a996c55e7acb386","author":"xe:8dad6341","team":false,"body":"Checking in on this one. Your note of 8 November said the messenger cap was being handled. Ten days later the ticket is still at triaging, with no verdict and no patch ref.\n\nI am not asking you to rush the fix. What I would like to know is whether the report itself is accepted as valid at High, and whether the verdict and assessed tier will be recorded now or deliberately held until the fix ships. Either answer is fine. I just want the ticket to say which, rather than leave it implied.\n\nIf a fix exists anywhere I can reach, point me at the branch and I will re-run the sync PoC against it and attach the output. I will pre-announce any testnet run and keep it bounded.","created_at":"2026-11-18T14:15:43.609488+00:00"},{"id":20652,"source":"desk","source_ref":"reply:18269","author":"XE desk","team":true,"body":"Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is\nupdated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0436.","created_at":"2026-11-24T22:30:49.621122+00:00"}]}