Bounty
XE-2530 · Bounty

Conflict-winner promotion (SwapBlock) skips the timekeeper attestation freshness check — a stale lease_settle past the grace window commits and mints emission

Closed · duplicate —claimed Medium web filed 2026-11-10 03:36 UTC by Ntaaaaah

Report

Summary

SwapBlock (conflict-winner promotion) validates the winning block with the attestation freshness check disabled, so a lease_settle carrying stale timekeeper attestations commits through the conflict path even though the live POST path rejects the identical block. In a local harness I settled a lease ~72 hours past its grace window using attestations ~3 days old (median still inside the grace window): the live path rejected the block with "only 0 valid attestations from trusted timekeepers, need 2", while the conflict path committed it, burned the escrow, and minted 667 µXE of emission. The grace window — the mechanism that is supposed to make a late settle impossible — is bypassed entirely on this path.

What I did

All testing in a local Go harness against the public repo (HEAD 02e9641). testnet-0005 was not touched, no live XUSD was used, no local testnet was run, and no other user's funds, keys, or workloads were involved.

Harness: poc-n1/main.go (package main inside a clone of the repo, same module). Go 1.27.3. Simulated clock via core.Now. Genesis overridden with a local keypair whose representative holds 100% of the delegated weight; Difficulty=0; local timekeeper threshold 2. XUSD/XE balances seeded via the test helpers MintForTesting / SeedAssetForTesting.

Scenario:

  1. T0: consumer opens a lease (60 s duration, cost 667 µXUSD); provider accepts with attestations @T0, LockedR=1000 → emission 667 µXE. Expiry T0+60 s, grace until T0+3660 s. Lease + accept finalized.
  2. T0+3 days: the lease is ~71 h 59 min past its grace window.
  3. Control: the same stale lease_settle (attestations @T0+30 min, median inside the grace window) submitted via AddBlock with no sibling.
  4. Exploit: provider first commits a send sibling on the same Previous (the accept hash), then submits the stale lease_settle ground (via Timestamp, 1 ns steps, 3 tries) to the lowest hash so the rep prefers it. Rep final-votes it; confirmConflict → SwapBlock → commit.

The harness was run 5 times in a row; all 5 runs were identical (same hashes, same control rejection, same exploit outcome, same balances, exit 0, N-1 REPRODUCED).

What happened

Control — live path (AddBlock, no sibling): REJECTED

  • Settle hash fc05c86525ac421d66c6539387eedf761484b76b6dcde7b618e97f6b25f91319
  • AddBlock rejected as expected: lease_settle attestation: only 0 valid attestations from trusted timekeepers, need 2

Exploit — conflict path (SwapBlock): COMMITTED

  • Send sibling committed first: 49316a2498f685ac103e58b7d0b293a32e85e902256d4a8474e07bd029116cc6
  • Stale settle (attestations @T0+30 min) ground to the lowest hash: 0ddba5d60182d53105406f077c493b49d9dc399f81a56373d3dd3e4a559f3b12 (3 tries)
  • Conflict recorded (totalWeight=42000000000000); rep final-voted the settle (weight 42000000000000 = 100%); confirmConflict → SwapBlock → commit.
  • Verified outcome: settle on-chain and at the frontier; the send is removed from the canonical chain (status Rejected); escrow pending is gone; lease state = settled; provider XE balance 1,000,000 → 1,000,667 (667 µXE of emission minted).

Impact

  • The settle grace window is bypassed on the conflict path: a provider can settle a lease long after expiry+grace, burning the escrow and minting emission the protocol says should not be minted after grace.
  • The same bypass applies to the sibling block types validated through the same path: lease_accept locks stale-epoch emission parameters (validateLockedEmissionAt reads the stale time) and lease_force_settle refunds at a stale forceTime.
  • Cheap to attempt in principle: it needs one lease, one conflicting send, and the stale block ground to the lowest hash (the rep auto-votes the lowest hash among candidates it knows).
  • This is Medium, not High: on a live network the attacker must win a race — both siblings must be visible to the rep within the ~3 second stability window, and the stale block must be the lowest hash among the candidates the rep knows. The harness also simplifies the network (see Notes).

Expected behavior

Conflict promotion should apply the same attestation freshness check as the live path, or stale-attestation blocks should be rejected at staging / promotable time. A block that the live path rejects for stale attestations should not become committable by being wrapped in a conflict.

Root cause (code, public repo HEAD 02e9641)

  • core/ledger.go:3003 (SwapBlock): calls dispatchValidateAndAdd(newBlock, true) — the true is skipTimestamp, which lease_settle treats as skipSkew=true. In validateAndAddLeaseSettle (core/ledger.go:2117-2250) this reaches ValidateAttestations(..., skipSkew=true), skipping the ±10 minute attestation freshness check; the median-time gate (settleTime >= expiry && settleTime <= expiry+Grace, core/ledger.go:2161-2175) then reads the stale median and passes.
  • core/quorum.go:236-266 (promotable): only runs ValidateStagedBlock, which for lease_settle / lease_accept / lease_force_settle only checks balance + pending escrow — no attestation check (core/ledger.go:2732-2862).
  • core/finalization.go:139 (castVoteLocked) → lowestHash (core/vote.go:271): the rep automatically votes the lowest-hash sibling, so a ground stale block wins the vote.

Relation to XE-0010 (not a duplicate)

XE-0010 (Accepted) is about the same kind of gap on a different path: sync ingestion (AddSyncedBlock) skips the freshness check. This report is a different code path (SwapBlock, conflict-winner promotion), a different entry point, and a sharper impact (grace-window bypass + emission minted, versus a lapsed renewal committing as history). A fix that only touches the sync path does not close this path. XE-0010 itself states its scope is "the /xe/sync path" and does not mention SwapBlock or promotion.

Reproduction steps

  1. Clone the public repo at HEAD 02e9641; Go ≥ 1.25.
  2. Place the harness at poc-n1/main.go (package main, same module) and run from the repo root: go run ./poc-n1
  3. Observe the control: the stale settle is rejected on the live path ("only 0 valid attestations from trusted timekeepers, need 2").
  4. Observe the exploit: the send sibling commits, the stale settle is ground to the lowest hash, the rep final-votes it, confirmConflict → SwapBlock commits it, and the provider balance goes 1,000,000 → 1,000,667 µXE.
  5. Re-run 5 times — the harness is deterministic (identical hashes and verdicts in all 5 runs).

Evidence

  • Harness: poc-n1/main.go (attached).
  • Full logs of the 5 verification runs: rerun-20261110-1.log … rerun-20261110-5.log (all exit 0, N-1 REPRODUCED; identical except for the wall-clock second in the genesis log line).
  • Earlier full log + result summary: run-20261110-3.log, RESULT.md.
  • Key hashes (identical in all 5 runs): control settle fc05c86525ac421d66c6539387eedf761484b76b6dcde7b618e97f6b25f91319; send sibling 49316a2498f685ac103e58b7d0b293a32e85e902256d4a8474e07bd029116cc6; exploit settle 0ddba5d60182d53105406f077c493b49d9dc399f81a56373d3dd3e4a559f3b12.

Notes

  • The harness simplifies the network: one rep holds 100% of the delegated weight (similar to the public ldn node's dominance on testnet-0005, but still a simplification) and Difficulty=0. On a live network there is a race: the rep has a ~3 second stability window, so the attacker must make both siblings visible to the rep within that window, since castVoteLocked picks the lowest hash among the candidates it already knows.
  • Side finding while building the harness: PoWNonce is NOT part of the block-hash preimage (HashBlock = canonical + aux; the nonce only appears in the binary wire format MarshalBlock). Hash grinding must therefore go through a hashed field — in this PoC, Timestamp in 1 ns steps, staying inside the ±1 hour window. "Grind the nonce to the lowest hash" does not work as-is on the live network.
  • lease_renew cannot be a conflict candidate on this path: ValidateStagedBlock has no case BlockLeaseRenew → "staged block: unknown type: lease_renew" (core/ledger.go:2867; = GitHub #4 F3.3). So this report is specifically about settle / accept / force-settle.
  • No testnet-0005 interaction, no live XUSD, no local testnet, no other user's funds, keys, or workloads were touched.

Thread

Joseph Denneteam2026-11-15 11:08 UTCdesk

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-2530 and says what differs; it is read like any other.