Bounty
XE-0094 · Bounty

Final votes frozen at receipt-time weight, counted against a later snapshot total

Closed · duplicate —claimed High xe#159 filed 2026-10-29 02:45 UTC by 0xMissy22

Report

Final votes frozen at receipt-time weight, counted against a later snapshot total

Summary

A final vote that arrives before its conflict record exists takes the representative's live weight at receipt time. The conflict's weight snapshot is created only when the second fork block arrives, and it is never used to re-weight stored votes. The final tally then sums stored (stale) weights against the snapshot total, so a fork can finalize on counted weight that no longer exists — in the worked case, counted 70/100 while true current support is 30/100.

Impact

Whoever holds the finalized block's transfers wins, so a finalization on stale weight decides who gets paid. With different conflict-detection times, two honest nodes (no equivocation — each representative voted once, finally) can finalize different winners during ordinary delegation churn. That two-node divergence has now been executed (see below); it matches the program's Critical example (conflicting finalized histories), but the tier is kept at High by researcher decision 2026-10-29 (Critical option declined) — upgrading to Critical would change the submission channel to email-first, and the program's security@xe.network address has no MX records (see Caveats).

Suggested program tier: High (finality safety; held below Critical for the reason above).

Root cause

  • core/vote.go receiveVoteInner: with no conflict record yet, the vote's counted weight is the current live delegated weight, and the row is stored.
  • core/ledger.go (conflict detection): the weight snapshot and total are assigned only when the second fork block arrives and the conflict is new. Nothing ever refreshes the snapshot afterwards, and nothing ever re-weights stored votes.
  • core/vote.go receiveVoteInner: a stored row that is already final is returned early — no weight recompute, no overwrite. Re-affirmed final votes (re-emitted on a 15-second backoff) are therefore also discarded for weight purposes, and the stale weight sticks.
  • core/quorum.go finalTally: sums the stored weights of final votes and compares against the snapshot total (falling back to the live total only when the snapshot total is zero). A pre-conflict final vote thus counts at receipt-time weight against a detection-time total.

Proof of concept

Target: xeprotocol/xe @ 978785929bc17a2f4ab30c383e5fc9cf4d634512 (2026-10-15). The harness uses in-package fake stores plus the real VoteManager / QuorumManager / vote-signing code; the repository itself is not modified.

Attached PoC: pocs/presenter-slice2-test.go.txt (byte-identical copy of the runnable test; copy it to core/zz_presenter_slice2_test.go inside a scratch copy of the repository, never the real repo).

Run (Go 1.25.14):

export PATH="$HOME/.local/go/bin:$PATH"
cd <scratch copy of xe>
GOPROXY=off go test ./core/ -run TestPresenterFrozenFinalWeightVsSnapshot -v -count=1

Worked shape: representatives R=50, S=30, T=20 (total 100). R and T final-vote fork X (70/100, genuine at lock time). A whale re-delegates 40 from R to S before a slow node detects the conflict. That node's snapshot is R=10, S=70, T=20 (total still 100), but R's stored final vote still weighs 50, so X finalizes at counted 70/100 while current support is 10+20=30/100.

Observed output (verbatim):

R pre-conflict final vote stored weight=50
R stored weight after re-affirm still=50 (snapshot says 10)
FINALIZED winner on counted 70/100 while current-weight support is 30/100 (final height 2)

Expected if weights were consistent: no finalization (30 < 67), or R's stored weight re-based to the snapshot value 10, giving counted 30/100.

Two-node divergence (executed 2026-10-29)

Attached PoC: pocs/presenter-divergence-test.go.txt (byte-identical copy of the runnable test; same scratch-copy setup as above).

Run (Go 1.25.14):

export PATH="$HOME/.local/go/bin:$PATH"
cd <scratch copy of xe>
GOPROXY=off go test ./core/ -run TestPresenterTwoNodeDivergentFinalization -v -count=1

Setup: two ledgers, same conflict position, same final-vote set (R votes fork X, T votes fork X, S votes fork Y — each once, finally, no equivocation). Node A's chain holds X and its detection-time snapshot is 50/30/20; node B's chain holds Y and its snapshot is 10/70/20 (whale re-delegated 40 from R to S before B detected the conflict).

Observed output (verbatim):

DIVERGENCE: A finalized X, B finalized Y, same position (eaa22bb39270, aeebad4a796f...), no equivocation (R->X, T->X, S->Y once each); B stored R=10 S=70
--- PASS: TestPresenterTwoNodeDivergentFinalization (0.01s)

So node A finalized X on counted 70/100 while node B finalized Y on counted 70/100, for the same conflict position, with no equivocation anywhere.

Reproduction steps

  1. R and T final-vote fork X (70/100 at lock time) on a slow node that has not yet seen the conflicting fork.
  2. Re-delegate 40 weight from R to S before the slow node detects the conflict.
  3. The slow node detects the conflict, snapshots R=10, S=70, T=20, and tallies the stored votes — X finalizes at counted 70/100.

Recommended fix

On conflict creation, re-weight all stored votes for that position from the new snapshot (including final rows); and/or re-weight stored final votes on every receipt of a re-affirmed final vote; and/or include the snapshot (or its hash) in the conflict record that nodes agree on before counting.

Severity

  • CVSS 3.1: 5.9 — CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
  • CWE-840 (Business Logic Errors)
  • AC:H: the flaw needs re-delegation timing plus a slow-node detection window.

Caveats

  • The harness seeds weights and chains directly to isolate the tally logic; it proves the accounting flaw, not a full-network reproduction. The two-node divergence above is a two-ledger harness execution, not a live two-node network run — that is why this is filed as High, not Critical.
  • Tier note: the executed divergence matches the program's Critical example (conflicting finalized histories). Upgrading this report to Critical would change the required channel to email-first to security@xe.network, whose MX records were absent on two independent resolvers at verification time (see the audit's program notes); that channel question was decided by the researcher 2026-10-29: stays High, Critical option declined.
  • No public prior report of the frozen-weight / snapshot-tally mechanism was found (dedup queries recorded in the audit's DEDUP-BASELINE.md).
  • This reproduction runs against the repository code at the stated HEAD. No testnet transactions were sent as part of this report.

Payout address (XE): eff2c51dd8457df740b919226cd9b37a2944e5abea7501094db80234f87f010e

Best, Chaplin

presenter-slice2-test.go.txt presenter-divergence-test.go.txt

Thread

Joseph Denneteam2026-11-05 22:12 UTCgithub

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