Bounty
XE-13349 · Bounty

Report bug

Closed · duplicate — xe#494 filed 2026-11-12 03:18 UTC by Gib230223

Report

XE Bounty — Laporan siap file (temuan pass 3 #2)

File issue baru di: https://github.com/xeprotocol/xe/issues/new Paste judul + isi di bawah. Akun GitHub: Gib230223.


Judul

[Low] ValidateStagedBlock BlockLeaseSettle accepts any self-asserted Amount and any Asset

Isi

Summary

In core/ledger.go, the staged BlockLeaseSettle case in ValidateStagedBlock (~lines 2794–2807) checks only the uint64 overflow guard and the balance equation b.Balance == parentBalance + b.Amount. It never checks b.Asset == "XE", never checks b.Amount == LeaseTotalEmission(lease), and never checks that the lease exists, is Accepted, is expired, or has valid attestations. Full admission (validateAndAddLeaseSettle, core/ledger.go:2117–2250) requires all of those. So a staged settle with a forged Amount or a wrong Asset is staged-valid but full-invalid — the XE-0028 quorum-decoy pattern.

The settle case is the odd one out: the sibling staged cases anchor their amount to a real store value — staged BlockReceive (~2774) requires b.Amount == pending.Amount, staged BlockLeaseCancel / BlockLeaseForceSettle tie the balance to pending.Amount. Settle uses the block's own self-asserted b.Amount instead.

Evidence

// core/ledger.go — staged BlockLeaseSettle case (~2794–2807)
pending, err := l.store.GetPendingSend(b.Source)
if err != nil { return fmt.Errorf("staged lease_settle: GetPendingSend: %w", err) }
if pending == nil { return fmt.Errorf("staged lease_settle: no pending escrow for lease") }
expectedBal := parentBalance + b.Amount
if expectedBal < parentBalance {
    return fmt.Errorf("staged lease_settle: balance would overflow uint64")
}
if b.Balance != expectedBal {
    return fmt.Errorf("staged lease_settle: balance mismatch: expected %d, got %d", expectedBal, b.Balance)
}
// No check of b.Asset, no check of b.Amount against the lease.

Full admission requires what staging skips (core/ledger.go):

  • :2119 — lease_settle block must have asset=XE
  • :2070 LeaseTotalEmission(lease) + :2174 / :2183 — lease_settle XE mismatch: expected %d (segments=%d, base cost=%d, R=%d), got %d
  • lease.State must be LeaseAccepted; ValidateAttestations must pass; settleTime within [expiry, expiry+grace].

Impact (Low)

Staged-valid / full-invalid quorum decoy. Reachable from normal balances (no 2^64 needed; any provider can forge a decoy settle for their own lease), but the attacker must be the account owner (provider) and full admission blocks the commit, so the impact is a chain-position stall / wasted quorum, not theft. Related note: the staged cancel/force_settle/accept cases also skip the Asset check (full admission requires Asset=="XUSD" for all three) — same class, different cases, not claimed here.

Reproduction (PoC)

MemStore ledger, signed blocks (core.SignBlock, ValidateStagedBlock):

staged lease_settle amount=1e12: ACCEPTED (nil error) — BUG
staged lease_settle amount=200: ACCEPTED (nil error) — BUG
staged lease_settle asset=XUSD: ACCEPTED (nil error) — BUG
staged lease_cancel (balance != parent+pending): REJECTED (staged lease_cancel: balance mismatch: expected 1200, got 1000999) — correct, amount is anchored

Two different "emissions" (1e12 and 200) for one 200-unit escrow both pass staged validation; only one can be real. The Asset="XUSD" settle would be rejected by full admission ("lease_settle block must have asset=XE").

Suggested fix

In the staged BlockLeaseSettle case, anchor the amount to the lease the way the sibling cases anchor to pending.Amount: require b.Asset == "XE" and b.Amount == LeaseTotalEmission(lease) (fetching the lease by b.Source), the same checks full admission already performs.

Novelty note

No ticket covers the staged settle Amount. Closest, all verified: XE-0028 (the general staged class, Accepted Medium); XE-5065 (scoped to overflow on cancel/force_settle + semantic checks for staged lease CREATE/ACCEPT only); XE-6782 (scoped to staged mint/burn/receive; its "why not a duplicate" section confirms the board treats each staged case family separately — the precedent this filing relies on); XE-2636/XE-7353 (cancel/force_settle overflow); GitHub #401 (empty-asset defaulting to XE in core/quorum.go promotable/confirmConflict — a different mechanism in a different function, about the asset default, not the Amount anchor); GitHub #52 (the general class). Checked the live bounty board (High+Medium and Minor views) and the GitHub repo issues, 2026-11-12.

Repo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.

Thread

Joseph Denneteam2026-11-20 00:34 UTCgithub

Thanks. This is the same finding as https://bounty.xe.network/XE-0028, 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-13349 and says what differs; it is read like any other.