Bounty
XE-8797 · Bounty

ValidateStagedBlock admits lease_accept blocks with no timekeeper attestations and lease_settle blocks with an arbitrary emission amount — both are then treated as finalisable winners

Closed · duplicate —claimed Medium web filed 2026-11-12 00:58 UTC by xe:8d50b3a1

Report

ValidateStagedBlock admits lease_accept blocks with no timekeeper attestations and lease_settle blocks with an arbitrary emission amount — both are then treated as finalisable winners

  • Repo / HEAD: github.com/xeprotocol/xe @ 89a542ea51d38375299aee54c6c99102e9bfa666 (testnet-0005)
  • Class: validation-skipping sibling path (conflict staging vs full admission), same family as XE-1968 / XE-7366 / XE-7367 but different object types and different skipped checks (see Dedupe).
  • Suggested tier: Medium (ceiling 2,500 XE) — reasoning at the end; a Minor assessment is plausible.

Summary

When a signed block conflicts with an existing block at the same account position, Ledger.addBlock does not run the full per-type validator (dispatchValidateAndAdd). It runs the much weaker ValidateStagedBlock (core/ledger.go:2732) and, on success, stores the block as a conflict candidate and returns nil (success). The quorum layer then uses only ValidateStagedBlock to decide whether a winning candidate is promotable (QuorumManager.promotable, core/quorum.go:260), and vote weight for it is tallied normally. Full validation is only attempted at promotion time (confirmConflict → SwapBlock/appendStagedWinner → dispatchValidateAndAdd), where these blocks deterministically fail — so the position withholds finality instead of finalising the honest sibling.

For two lease types the staged/full gap is not a nuance but the entire security content of the block type:

1. lease_accept — attestations, stake, certificate and locked-emission checks all skipped

Full path — validateAndAddLeaseAccept (core/ledger.go:1607) requires, among other things:

expectedStake := LeaseStake(leaseBlock.Amount)
if b.Amount != expectedStake {
    return fmt.Errorf("lease_accept stake mismatch: expected %d, got %d", expectedStake, b.Amount)
}
...
startTime, err := ValidateAttestations(b.Attestations, b.Source, tkConfig, skipSkew)
if err != nil {
    return fmt.Errorf("lease_accept attestation: %w", err)
}
...
if leaseBlock.CertificateHash != b.CertificateHash { ... }
certInfo := l.certificateLookupFn(b.CertificateHash)   // must exist, provider must match, startTime <= ExpiresAt
...
if lockedR == 0 { return fmt.Errorf("lease_accept missing locked emission params...") }
if err := l.validateLockedEmissionAt(startTime, lockedR, lockedCap, lockedTWAP, skipSkew, "lease_accept"); err != nil { return err }

(plus asset == XUSD, source block exists and is a lease, provider == lease destination, lease still in LeaseCreated state.)

Staged path — ValidateStagedBlock, core/ledger.go:2786, the complete check set for the same object:

case BlockLeaseAccept:
    if b.Amount > parentBalance {
        return fmt.Errorf("staged lease_accept: insufficient balance: have %d, need %d", parentBalance, b.Amount)
    }
    if b.Balance != parentBalance-b.Amount {
        return fmt.Errorf("staged lease_accept: balance mismatch: expected %d, got %d", parentBalance-b.Amount, b.Balance)
    }

No ValidateAttestations call (the block may carry zero attestations — the timekeeper-quorum proof of the lease start time is the whole point of this block type), no stake equality (any Amount ≤ parentBalance with matching balance arithmetic passes), no certificate binding, no locked-emission check, no lease-state or provider check.

2. lease_settle — emission amount is self-certified in the staged path

Full path — validateAndAddLeaseSettle (core/ledger.go:2117) requires asset == XE, lease exists and is in LeaseAccepted state, lease.Provider == b.Account, a valid timekeeper attestation median inside [expiry, expiry+LeaseSettleGrace], and:

expectedXE, err := LeaseTotalEmission(lease)
...
if b.Amount != expectedXE {
    return fmt.Errorf("lease_settle XE mismatch: expected %d (segments=%d, base cost=%d, R=%d), got %d", ...)
}

Staged path — core/ledger.go:2793, the complete check set:

case BlockLeaseSettle:
    pending, err := l.store.GetPendingSend(b.Source)
    if err != nil { ... }
    if pending == nil {
        return fmt.Errorf("staged lease_settle: no pending escrow for lease")
    }
    expectedBal := parentBalance + b.Amount
    if expectedBal < parentBalance { ... overflow ... }
    if b.Balance != expectedBal {
        return fmt.Errorf("staged lease_settle: balance mismatch: expected %d, got %d", expectedBal, b.Balance)
    }

expectedBal is derived from b.Amount itself, so any amount passes as long as an escrow is pending: a settle claiming 1 XE or 10⁹ XE for the same lease is equally "valid" to the staged validator. Asset is not checked either (the pre-staging gate in addBlock only requires some valid asset, XE or XUSD), nor are provider, lease state, or the attestation window.

The invalid objects (concrete constructions)

Both are built the same way: the attacker needs one ordinary block already on an account chain at position P, then signs a second block with the same Previous. The second block is routed to staging by detectConflictSibling (core/conflict.go:40, called at core/ledger.go:812).

  • Phantom accept: provider account with parent XUSD balance B. Sign a lease_accept at a position where a sibling already sits, with Source = any real lease hash, Amount = B (entire balance, not LeaseStake(lease.Amount)), Balance = 0, Attestations = empty, CertificateHash = empty, LockedR = 0. VerifyBlock/verifyBlockCredential pass (valid own signature; see actor note), the global checks in addBlock pass (PoW if enabled, timestamp window, asset XUSD), and ValidateStagedBlock accepts it. It is saved via SaveStagedBlock, a conflict is recorded, and representatives are asked to vote on it.
  • Phantom settle: provider account, lease with a live escrow pending. Sign a lease_settle at a conflicting position with Asset = "XUSD" (full path demands XE), Amount = any value X, Balance = parentBalance + X, no attestations. Staged-accepted the same way.

Trigger actor

Any account holder who can sign for the account position — and, notably, a single co-signer of a multisig account: IsSpendingOp (core/multisig.go:140) does not list lease_accept or lease_settle, so verifyBlockCredential (run before staging, core/ledger.go:~800, and again inside ValidateStagedBlock:2735) verifies them with VerifyMultisigAny — one of N keyset signatures is enough to stage the phantom block on a threshold account. (The 1-of-N classification itself is XE-0001's claim; the new point here is what that one signature can stage.) No DAO keys, no operator access, no victim key material needed. Cost: one PoW (when difficulty is on) and a self-inflicted conflict on the position.

Downstream consequence (traced)

  1. The phantom enters the conflict candidate set (recordConflict, SaveStagedBlock, addBlock returns nil).
  2. Representatives' vote managers consider staged blocks as candidates (GetBlockOrStaged in core/finalization.go / finalTally), and votes for it accumulate weight normally.
  3. QuorumManager.promotable (core/quorum.go:240-261) gates finalisation on ValidateStagedBlock(staged, parentBalance) == nil only — the phantom is "promotable" by the code's own definition.
  4. If it reaches ≥67% of final-vote weight, pickWinner selects it and confirmConflict tries promotion: SwapBlock → dispatchValidateAndAdd (or appendStagedWinner → dispatchValidateAndAdd) runs the full validator, which deterministically rejects it (no attestations / stake mismatch / amount ≠ LeaseTotalEmission). confirmConflict records a failed promotion, quarantines it for only failedPromotionTTL = 30 s (core/quorum.go:38), and — per the code's own log line — "no other candidate is substituted": the honest sibling is not finalised in its place.
  5. After 30 s the phantom is promotable again; the stale-conflict sweep (sweepStaleConflicts, every 15 s) re-tallies and re-attempts indefinitely. The account position never finalises while representatives keep weight on the phantom (their preference logic does not full-validate either), and everything downstream of that position stalls: subsequent blocks on the account cannot finalise past it, and cross-account flows referencing it (a consumer's lease whose accept/settle sits at the frozen position, receives against a contested send on it — cf. the contested-source deferral in validateAndAddReceive) are stuck with it.

This is a finality-withholding / liveness break for the targeted account position, reachable at the cost of one signature — not a balance corruption: promotion-time full validation does hold, and this report does not claim the phantom can be committed to the canonical chain.

Same-family gaps noted (not separately filed)

For completeness, the same function also skips, relative to the full validators: staged lease — certificate existence/provider/expiry, ValidateLeaseDimensions, cost equality (Amount == LeaseCost(...)), asset == XUSD, destination sanity; staged send/burn — ValidateMemo; staged mint — source/destination/memo emptiness; staged lease_cancel/lease_force_settle — consumer-only, lease-state and (for force-settle) attestation eligibility window. These have the same withholding-shaped impact and are listed here so the fix can be made uniformly (staged validation should reuse the full validators' side-effect-free checks).

Suggested fix

In ValidateStagedBlock, for lease_accept add: source lease exists and is a lease, provider/state consistency against the parent position, Amount == LeaseStake(lease.Amount), ValidateAttestations(...) (with the staged path's skew policy), certificate-hash equality with the lease block, and LockedR != 0 + validateLockedEmissionAt. For lease_settle add: asset == XE, provider/lease-state consistency, and Amount == LeaseTotalEmission(lease) computed from the lease record (not from b.Amount). More generally, gate promotable() on the same checks promotion will run, so an unpromotable candidate cannot win a tally.

Dedupe evidence

  • XE-1968 is statechain genesis ops skipping ValidateOp — different object (statechain genesis), different check. Not this.
  • XE-7366 is staged multisig_update accepting an invalid keyset that full admission rejects. Different object type and different skipped check.
  • XE-7367 is ValidateStagedBlock never checking timestamp monotonicity. Different skipped check; this report's objects would pass even with a perfectly monotonic timestamp.
  • xeprotocol/xe issue #8, Finding 2 claims the staged receive asset mismatch (b.Asset == pendingAsset) — a different object type and check; not re-reported here (verified still present at HEAD, deliberately excluded).
  • xeprotocol/xe issue #4, Finding 3.3 claims staged lease_renew is missing entirely (valid renews rejected). Different object and opposite direction; not re-reported.
  • Recon classes checked: 2 (quorum/finality — this is a new cause of withholding: lease-type staged validation, not a tally/finalTally bug), 6 (multisig — only the staging surface is new), 7 (lease lifecycle — no title in the class covers staged accept/settle validation), 9, 11, 14, 16 (no overlap). Board title search for ValidateStagedBlock, staged lease_accept, staged lease_settle returned no matching ticket (search index is partial; held Severe tickets are not publicly visible — residual hidden-duplicate risk is inherent to the board).

Tier reasoning

Medium (ceiling 2,500 XE). For: remotely triggerable by any account holder (or one multisig co-signer), no privileged keys; breaks finality for a real account position indefinitely and repeatably, with cross-account fallout for lease counterparties; the skipped checks are the core security content of the two block types (timekeeper quorum, emission amount). Against a higher tier: promotion-time full validation prevents any invalid state from being committed — impact is liveness, not theft or supply corruption — and creating the conflict requires signing against one's own (or one's shared) account position. That profile matches the board's Medium band; if the team weighs single-position withholding as local-only, Minor is the fallback.

Thread

Joseph Denneteam2026-11-20 00:04 UTCdesk

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