Bounty
XE-0654 · Bounty

[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)

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

Report

[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)

Repo pin: xeprotocol/xe master @ 02e9641 (2026-11-03), network testnet-0005 Component: core/quorum.go (finalTally, buildResultFrom, cleanupResolvedConflict) CWE: CWE-863 (Incorrect Authorization) — a vote authorises cleanup of hashes it never named 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 Suggested tier: High (10,000 XE) — remotely triggerable, one gossip message, permanent targeted fund lock.

Summary

finalTally inserts every stored vote's BlockHash into candidateSet before the retrievability / account / previous filter runs. buildResultFrom then defines losers as candidateSet - winner, and cleanupResolvedConflict calls rejectBlocks(losers) (which sets StatusRejected) and DeleteStagedBlock(loser) for each. Staged blocks are keyed by hash alone in the store, so the delete hits any account's staged body.

A vote's signature covers {rep, block_hash, conflict_account, conflict_prev, timestamp, final} — ValidateVote never checks that block_hash belongs to (conflict_account, conflict_prev). So a representative with any positive vote weight can sign one vote whose BlockHash is a victim's staged block on a different account or position, place it at a conflict position that later resolves, and the victim's staged block is destroyed as a "loser" of a conflict it was never part of.

Affected code

  • core/quorum.go:111-112 — candidateSet[v.BlockHash] = true runs before the GetBlockOrStaged / b.Account != account / b.Previous != previous filter at lines 120-123.
  • core/quorum.go:221-234 — buildResultFrom: losers = candidateSet - winner.
  • core/quorum.go:399-406 — cleanupResolvedConflict: rejectBlocks(losers) + DeleteStagedBlock(loser) for every loser.

Proof of concept

Drop-in tests, run against a fresh clone at the pinned commit:

git clone https://github.com/xeprotocol/xe.git && cd xe && git checkout 02e9641
cp zz_internal_test.go zz_pollution_test.go core/
go test ./core/ -run TestCrossPositionLoserPollution -v

Output (executed 2026-11-04):

=== RUN   TestCrossPositionLoserPollution
2026/11/04 08:43:54 Genesis block applied: 42000000000000 XE to aa0f671c8610...
    zz_pollution_test.go:113: setup ok: v2 staged=89b34762fbb3
    zz_pollution_test.go:128: polluting vote for 89b34762fbb3 at (aa0f671c,bdb6e0f9) accepted
    zz_pollution_test.go:139: after resolution: staged(v2)=false  status(v2)=2 (2=Rejected)
    zz_pollution_test.go:147: victim conflict still open with candidates [7245119dbbbd 89b34762fbb3] — v2 can never win now
--- PASS: TestCrossPositionLoserPollution (0.02s)

The polluting vote names the victim's staged block hash at a different position; the vote is accepted; when the conflict at the attacker's position resolves, the victim's staged body is deleted and marked StatusRejected while the victim's own conflict record stays open holding a bodyless candidate.

Impact

  • Permanent account freeze (fund lock). Ledger.addBlock rejects every new block for an account with an unresolved conflict record (core/ledger.go:815-818), and finalTally drops votes whose block is not retrievable (quorum.go:120-123) — so the victim's candidate can never win again. The account's funds are unspendable until the conflict is resolved, which it never can be.
  • Any staged block on the network is destroyable by any staked representative with a single gossip message; no authentication beyond a delegated key, no PoW, no funds.
  • Secondary: marking a hash StatusRejected also makes conflictOrphanedByRollback (quorum.go:515-524) classify the victim's conflict as orphaned, silently dropping it and deleting its votes.

Duplication check

Not a duplicate of: XE-0161 (unbounded vote-store growth for nonexistent conflicts — storage, not cleanup), XE-0045 (zero-weight vote admission — admission policy), XE-0052 (staged blocks that fail full admission), XE-0042 (pickWinner substituting a non-quorum winner). None of them touch candidateSet/LoserHashes pollution or the cross-account DeleteStagedBlock.

Suggested fix

Move candidateSet[v.BlockHash] = true after the retrievability + account + previous filter (only hashes that actually belong to this conflict position may enter the candidate set), and have cleanupResolvedConflict re-verify each loser's account/previous before deleting or rejecting it.

Thread

Joseph Denneteam2026-11-05 22:18 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0435, 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.