{"id":"XE-0654","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":"XE-0435","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:23.665229+00:00","updated_at":"2026-11-05T22:18:59.850495+00:00","source_created_at":null,"told_at":"2026-11-05T22:18:59.924559+00:00","status_changed_at":"2026-11-05T22:18:59.899400+00:00","url":"https://bounty.xe.network/XE-0654","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":489,"source":"desk","source_ref":"reply:215","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0435, 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:18:59.850495+00:00"}]}