{"id":"XE-0435","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":202,"title":"[Consensus] Conflict cleanup treats every voted hash as a loser: one vote from any weighted representative deletes another account's staged block and freezes the account (High)","area":"consensus","claimed_tier":"high","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"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-04T09:03:32.491896+00:00","updated_at":"2026-11-14T22:52:51.546685+00:00","source_created_at":null,"told_at":"2026-11-14T22:52:52.434924+00:00","status_changed_at":"2026-11-08T20:32:05.344500+00:00","url":"https://bounty.xe.network/XE-0435","body":"# [Consensus] Conflict cleanup treats every voted hash as a loser: one vote from any weighted representative deletes another account's staged block and freezes the account (High)\n\n**Repo pin:** `xeprotocol/xe` master @ `02e9641` (2026-11-03), network `testnet-0005`\n**Component:** `core/quorum.go` (`finalTally`, `buildResultFrom`, `cleanupResolvedConflict`)\n**CWE:** CWE-863 (Incorrect Authorization) — a vote authorises cleanup of hashes it never named\n**CVSS 3.1:** 8.2 High — `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L`\n**Suggested tier:** High (10,000 XE) — remotely triggerable, one gossip message, permanent\ntargeted fund lock.\n\n## Summary\n\n`finalTally` inserts **every** stored vote's `BlockHash` into `candidateSet` *before* the\nretrievability / account / previous filter runs. `buildResultFrom` then defines losers as\n`candidateSet - winner`, and `cleanupResolvedConflict` calls `rejectBlocks(losers)` (which sets\n`StatusRejected`) and `DeleteStagedBlock(loser)` for each. Staged blocks are keyed by hash alone\nin the store, so the delete hits **any account's** staged body.\n\nA vote's signature covers `{rep, block_hash, conflict_account, conflict_prev, timestamp, final}` —\n`ValidateVote` never checks that `block_hash` belongs to `(conflict_account, conflict_prev)`. So a\nrepresentative with any positive vote weight can sign one vote whose `BlockHash` is a victim's\nstaged block on a different account or position, place it at a conflict position that later\nresolves, and the victim's staged block is destroyed as a \"loser\" of a conflict it was never part\nof.\n\n## Affected code\n\n- `core/quorum.go:111-112` — `candidateSet[v.BlockHash] = true` runs **before** the\n  `GetBlockOrStaged` / `b.Account != account` / `b.Previous != previous` filter at lines 120-123.\n- `core/quorum.go:221-234` — `buildResultFrom`: `losers = candidateSet - winner`.\n- `core/quorum.go:399-406` — `cleanupResolvedConflict`: `rejectBlocks(losers)` +\n  `DeleteStagedBlock(loser)` for every loser.\n\n## Proof of concept\n\nDrop-in tests, run against a fresh clone at the pinned commit:\n\n```\ngit clone https://github.com/xeprotocol/xe.git && cd xe && git checkout 02e9641\ncp zz_internal_test.go zz_pollution_test.go core/\ngo test ./core/ -run TestCrossPositionLoserPollution -v\n```\n\nOutput (executed 2026-11-04):\n\n```\n=== RUN   TestCrossPositionLoserPollution\n2026/11/04 08:43:54 Genesis block applied: 42000000000000 XE to aa0f671c8610...\n    zz_pollution_test.go:113: setup ok: v2 staged=89b34762fbb3\n    zz_pollution_test.go:128: polluting vote for 89b34762fbb3 at (aa0f671c,bdb6e0f9) accepted\n    zz_pollution_test.go:139: after resolution: staged(v2)=false  status(v2)=2 (2=Rejected)\n    zz_pollution_test.go:147: victim conflict still open with candidates [7245119dbbbd 89b34762fbb3] — v2 can never win now\n--- PASS: TestCrossPositionLoserPollution (0.02s)\n```\n\nThe polluting vote names the victim's staged block hash at a different position; the vote is\naccepted; when the conflict at the attacker's position resolves, the victim's staged body is\ndeleted and marked `StatusRejected` while the victim's own conflict record stays open holding a\nbodyless candidate.\n\n## Impact\n\n- **Permanent account freeze (fund lock).** `Ledger.addBlock` rejects every new block for an\n  account with an unresolved conflict record (`core/ledger.go:815-818`), and `finalTally` drops\n  votes whose block is not retrievable (`quorum.go:120-123`) — so the victim's candidate can never\n  win again. The account's funds are unspendable until the conflict is resolved, which it never\n  can be.\n- **Any staged block on the network is destroyable** by any staked representative with a single\n  gossip message; no authentication beyond a delegated key, no PoW, no funds.\n- Secondary: marking a hash `StatusRejected` also makes `conflictOrphanedByRollback`\n  (`quorum.go:515-524`) classify the victim's conflict as orphaned, silently dropping it and\n  deleting its votes.\n\n## Duplication check\n\nNot a duplicate of: XE-0161 (unbounded vote-store growth for nonexistent conflicts — storage,\nnot cleanup), XE-0045 (zero-weight vote admission — admission policy), XE-0052 (staged blocks\nthat fail full admission), XE-0042 (pickWinner substituting a non-quorum winner). None of them\ntouch `candidateSet`/`LoserHashes` pollution or the cross-account `DeleteStagedBlock`.\n\n## Suggested fix\n\nMove `candidateSet[v.BlockHash] = true` **after** the retrievability + account + previous filter\n(only hashes that actually belong to this conflict position may enter the candidate set), and\nhave `cleanupResolvedConflict` re-verify each loser's account/previous before deleting or\nrejecting it.","patch_refs":[],"thread":[{"id":181,"source":"web","source_ref":"reporter:202:e69fc11e5a8aea68","author":"xe:8dad6341","team":false,"body":"Clarification on scope, so this is not triaged against the wrong neighbour:\n\nThis report is **not** XE-0402 (\"Staged-block store is unbounded and leaks on non-resolved\nexit\"). XE-0402 is about the staged-block store growing without bound and leaking memory on\nnon-resolved exit paths — a resource/volume defect in the store itself.\n\nThis finding is the opposite direction: the store is *written correctly*, but\n`cleanupResolvedConflict` (core/quorum.go:399-406) **deletes** a staged block that belongs to a\ndifferent account or a different conflict position, because `finalTally` inserts every voted\n`BlockHash` into `candidateSet` (core/quorum.go:111-112) before the account/previous filter at\nlines 120-123, and `buildResultFrom` (quorum.go:221-234) defines losers as\n`candidateSet - winner`. One signed vote from any weighted representative whose `BlockHash` names\na victim's staged block is enough; the victim's candidate is then deleted and marked\n`StatusRejected`, its conflict can never resolve, and `Ledger.addBlock` freezes the account\n(core/ledger.go:815-818). The drop-in test in the attachments demonstrates exactly that:\nafter an unrelated conflict resolves, `GetStagedBlock(victim) = nil` and\n`GetBlockStatus(victim) = StatusRejected`.\n\nAlso not XE-0052 (staged validation weaker than full admission) or XE-0042 (pickWinner\nsubstituting a non-quorum winner): neither touches candidateSet/LoserHashes pollution or the\ncross-account DeleteStagedBlock.","created_at":"2026-11-04T09:09:38.051196+00:00"},{"id":193,"source":"web","source_ref":"reporter:202:fdf2014ed1b6677e","author":"xe:8dad6341","team":false,"body":"Clarification on scope, so this is not triaged against the wrong neighbour:\n\nThis report is **not** XE-0402 (\"Staged-block store is unbounded and leaks on non-resolved\nexit\"). XE-0402 is about the staged-block store growing without bound and leaking memory on\nnon-resolved exit paths — a resource/volume defect in the store itself.\n\nThis finding is the opposite direction: the store is *written correctly*, but\n`cleanupResolvedConflict` (core/quorum.go:399-406) **deletes** a staged block that belongs to a\ndifferent account or a different conflict position, because `finalTally` inserts every voted\n`BlockHash` into `candidateSet` (core/quorum.go:111-112) before the account/previous filter at\nlines 120-123, and `buildResultFrom` (quorum.go:221-234) defines losers as\n`candidateSet - winner`. One signed vote from any weighted representative whose `BlockHash` names\na victim's staged block is enough; the victim's candidate is then deleted and marked\n`StatusRejected`, its conflict can never resolve, and `Ledger.addBlock` freezes the account\n(core/ledger.go:815-818). The drop-in test in the attachments demonstrates exactly that:\nafter an unrelated conflict resolves, `GetStagedBlock(victim) = nil` and\n`GetBlockStatus(victim) = StatusRejected`.\n\nAlso not XE-0052 (staged validation weaker than full admission) or XE-0042 (pickWinner\nsubstituting a non-quorum winner): neither touches candidateSet/LoserHashes pollution or the\ncross-account DeleteStagedBlock.\n\n---\n\nCVSS correction: vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L computes to 7.1, not 8.2.\nISC=1-(1-0.56)(1-0.22)=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:28.431921+00:00"},{"id":3650,"source":"desk","source_ref":"reply:2392","author":"XE desk","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, 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, file a new report that links https://bounty.xe.network/XE-0435 and says what differs; it is read like any other.","created_at":"2026-11-14T22:52:51.546685+00:00"}]}