Bounty
XE-1088 · Bounty

[HIGH] core: Cross-position vote candidate injection lets any positive-weight representative permanently lock FinalVoteStore on a foreign block hash and brick account finality

Closed · duplicate — xe#289 filed 2026-11-07 14:42 UTC by pa-khan

Report

Summary

QuorumManager.finalTally (core/quorum.go:120-123) verifies that a FINAL vote's BlockHash belongs to the target conflict slot (account, previous) before counting its weight toward the 67% finality threshold:

b := qm.ledger.GetBlockOrStaged(v.BlockHash)
if b == nil || b.Account != account || b.Previous != previous {
    continue
}

However, VoteManager (core/vote.go and core/finalization.go) never checks that v.BlockHash (or any candidate hash h gathered for (account, prev)) actually belongs to (account, prev). In addition, QuorumManager.finalTally (core/quorum.go:112) records candidateSet[v.BlockHash] = true before checking b.Account != account || b.Previous != previous.

Because of this mismatch between VoteManager and QuorumManager, any representative with positive vote weight (> 0, including a 1-micro-XE self-delegated account under RepModeOpen or any minor representative under RepModeAllowlist) can broadcast a CONVERGE vote for a victim's unresolved position (victimAccount, victimPrev) whose BlockHash points to an already-finalized block from a different chain/position B_foreign with B_foreign.Hash < B_victim.Hash (for example, genesis.Hash or any low-hash block on the attacker's own chain).

Honest representatives accept the cross-position vote, adopt B_foreign.Hash as their lowest-hash eligible candidate (lowestHash(eligible)), reach >=67% converge weight on B_foreign.Hash, and after the 3-second lockStabilityWindow permanently lock (victimAccount, victimPrev) -> B_foreign.Hash in the write-once FinalVoteStore (PutFinalVoteIfAbsent) and VoteStore. When QuorumManager.finalTally subsequently tallies (victimAccount, victimPrev), it ignores all FINAL votes for B_foreign.Hash because B_foreign.Account != victimAccount || B_foreign.Previous != victimPrev. Because FinalVoteStore and VoteStore are write-once for FINAL votes per (account, prev), honest representatives can never emit a FINAL vote for B_victim.Hash, permanently and irreversibly freezing victimAccount's FinalHeight across node restarts.


Root Cause

  1. ValidateVote and isConflictNotFound (core/vote.go:167-261) do not check block position: ValidateVote(v) verifies the signature, checks vm.ledger.GetVoteWeight(v.RepAccount()) > 0, and checks the timestamp window, but never checks whether b := vm.ledger.GetBlockOrStaged(v.BlockHash) (when present) satisfies b.Account == v.ConflictAccount && b.Previous == v.ConflictPrev.

  2. gatherCandidates, noteHeldCandidatesLocked, castVoteLocked, convergeWeights, and emitFinalLocked (core/finalization.go) only check GetBlockOrStaged(h) != nil:

    • gatherCandidates(account, prev, seed...) (core/finalization.go:354-376) collects every v.BlockHash from vm.store.GetVotesByConflict(account, prev) without checking the block's (Account, Previous).
    • noteHeldCandidatesLocked(account, prev, candidates) (core/finalization.go:197-216) checks only if vm.ledger.GetBlockOrStaged(h) == nil { continue }, allowing votes referencing arbitrary existing blocks on the lattice to reset vm.lastNewCandidateNanos[key] and stall the 3-second lockStabilityWindow.
    • castVoteLocked(account, prev, seed...) (core/finalization.go:128-146) admits any candidate h with vm.ledger.GetBlockOrStaged(h) != nil into eligible, picks pref := lowestHash(eligible), and checks vm.ledger.depsFinalized(prefBlock). For any already-finalized foreign block B_foreign (such as genesis or a finalized block on the attacker's chain), GetBlockOrStaged(B_foreign.Hash) is non-nil and depsFinalized(B_foreign) is true.
    • When B_foreign.Hash < B_victim.Hash, every honest representative switches its own CONVERGE vote for (victimAccount, victimPrev) to B_foreign.Hash with its full delegated weight.
    • maybeLockLocked -> emitFinalLocked(victimAccount, victimPrev, B_foreign.Hash) (core/finalization.go:265-306) then calls vm.ledger.finalVoteStore.PutFinalVoteIfAbsent(victimAccount, victimPrev, B_foreign.Hash) and stores a Final: true vote in VoteStore. Both stores refuse to overwrite a locked/final vote for (victimAccount, victimPrev).
  3. Cross-conflict LoserHashes pollution in QuorumManager.finalTally (core/quorum.go:111-123): In finalTally(account, previous), candidateSet[v.BlockHash] = true is executed on line 112 before the if b == nil || b.Account != account || b.Previous != previous check on line 121. If a voter submits a cross-position vote on (attackerAccount, attackerPrev) naming a victim's staged block B_victimStaged.Hash, resolving (attackerAccount, attackerPrev) places B_victimStaged.Hash into result.LoserHashes, causing cleanupResolvedConflict (core/quorum.go:399-405) to mark B_victimStaged.Hash as StatusRejected in QuorumStore and delete it via DeleteStagedBlock.


Impact

  • Permanent, irreversible account finality freeze (DoS / funds lock): Any voter with >= 1 micro-XE of weight can permanently freeze finality (FinalHeight) for any account block whose hash is lexicographically greater than any finalized block hash on the lattice (genesis.Hash alone is 038d0d04..., which is smaller than ~98.6% of SHA-256 block hashes, and an attacker can also grind a single low-hash block on their own chain). Once honest representatives write B_foreign.Hash into FinalVoteStore (prefixFinalVote in BadgerDB), the lock persists across restarts and the victim account can never finalize that height or spend subsequent balances.
  • Stability window stalling: Even using foreign blocks with higher hashes, an attacker can repeatedly reset lastNewCandidateNanos[key] in noteHeldCandidatesLocked by referencing distinct blocks already on the lattice.
  • Cross-conflict staged block deletion and StatusRejected poisoning: A cross-position vote on an attacker-controlled slot causes cleanupResolvedConflict to delete a victim's staged block and mark its hash StatusRejected.

Proposed Fix

  1. Add blockMatchesPosition(b *Block, account, prev string) bool and (l *Ledger) blockForPosition(account, prev, hash string) *Block in core/finalization.go.
  2. In ValidateVote and isConflictNotFound (core/vote.go), reject any vote whose v.BlockHash resolves via GetBlockOrStaged to a block that does not match (v.ConflictAccount, v.ConflictPrev).
  3. In gatherCandidates, noteHeldCandidatesLocked, castVoteLocked, convergeWeights, and emitFinalLocked (core/finalization.go), require resolved candidate blocks to match (account, prev) via blockMatchesPosition / blockForPosition (including before PutFinalVoteIfAbsent in emitFinalLocked).
  4. In QuorumManager.finalTally (core/quorum.go), check b != nil && !blockMatchesPosition(b, account, previous) before inserting v.BlockHash into candidateSet.

Payout wallet (Base / XE): 0x45Ecf534fD00bb3179D34E6a3FDdE084cBfBc9Fb

Thread

pa-khan2026-11-07 19:50 UTCweb

Claimed Tier: High (10,000 XE) / Severe (25,000 XE). Updated GitHub issue #289 title with [HIGH] prefix. Companion fix PR with regression tests: https://github.com/xeprotocol/xe/pull/290 — Bound XE Payout Address: 975f2f37dda1568c766729d9f85ad01e37f0c71d469af19d0b2aaaef861d9574

XE deskteam2026-11-14 22:52 UTCgithub

Thanks. This is the same finding as an earlier report that is not public, 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, file a new report that links https://bounty.xe.network/XE-1088 and says what differs; it is read like any other.