Bounty
XE-9786 · Bounty

Staged Block Validation Bypass: ValidateStagedBlock omits consumer authorization, lease state check, and attestation verification on BlockLeaseForceSettle

Closed · duplicate — web filed 2026-11-12 07:12 UTC by xe:e4cd6974

Report

Vulnerability Summary

In core/ledger.go:2732-2870, ValidateStagedBlock(b *Block, parentBalance uint64) error performs consensus validation on candidate blocks competing in BFT quorum elections before staging or promotion to the canonical ledger.

When BlockLeaseForceSettle is ingested normally through validateAndAddLeaseForceSettle (core/ledger.go:1879-1970), the node strictly verifies:

  1. b.Asset == "XUSD" (core/ledger.go:1880-1882).
  2. leaseBlock.Account == b.Account ensuring only the original consumer can force-settle their own lease (core/ledger.go:1896-1898).
  3. !lease.Settled && lease.State == LeaseAccepted (core/ledger.go:1914-1922).
  4. Timekeeper attestations verifying forceTime >= eligibleAt (where eligibleAt = expiry + LeaseSettleGrace + LeaseForceSettleGap) and forceTime < expiry + LeaseEscrowExpiry (core/ledger.go:1935-1946).
  5. Refund calculation taking into account the full lease escrow plus all renewal topups (commit.AssetCredit = &AssetDelta{Account: b.Account, Asset: "XUSD", Amount: refundAmount}).

However, inside ValidateStagedBlock (core/ledger.go:2821-2831):

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

Notice the critical omissions in ValidateStagedBlock for BlockLeaseForceSettle:

  1. Never checks b.Asset == "XUSD": It allows arbitrary asset tags (e.g. minting XE or cross-asset balance manipulation).
  2. Never checks consumer authorization (leaseBlock.Account == b.Account): Any third-party attacker account can stage a BlockLeaseForceSettle referencing another user's lease escrow (b.Source) and steal the escrow amount into their own balance!
  3. Never inspects lease state (l.store.GetLease): An active, unexpired, or already settled lease can be prematurely force-settled during staged conflict resolution!
  4. Never verifies timekeeper attestations: It bypasses the required wait gap (LeaseSettleGrace + LeaseForceSettleGap), allowing instant force-settlement without proof of provider inactivity.

Vulnerable Code Locations

  • core/ledger.go:2821-2831: ValidateStagedBlock for BlockLeaseForceSettle checks only that l.store.GetPendingSend(b.Source) exists and matches b.Balance == parentBalance + pending.Amount. It omits consumer ownership verification, lease state verification, attestation verification, and asset matching.

Attack & Failure Scenario

  1. Third-Party Escrow Hijacking / Premature Force-Settle:
    • Alice creates a lease escrow of 50,000 XUSD (b.Source).
    • Attacker Bob creates a staged BlockLeaseForceSettle candidate referencing Alice's escrow hash b.Source on his own account.
    • When Bob's candidate is validated via ValidateStagedBlock(candidate, parentBalance), the node checks:
      • pending != nil (Alice's escrow exists in store).
      • b.Balance == parentBalance + pending.Amount.
    • Because ValidateStagedBlock does not check leaseBlock.Account == b.Account, Bob's block passes validation!
    • If Bob's block is promoted via quorum, Bob receives Alice's 50,000 XUSD escrow refund directly into his balance.
  2. Permanent Consensus Split / BFT Fork:
    • Nodes ingesting the promoted block via standard peer sync (validateAndAddLeaseForceSettle) check leaseBlock.Account == b.Account and timekeeper attestations.
    • Syncing nodes reject the block with lease_force_settle: only the consumer can force-settle a lease or lease not yet force-settleable.
    • The network fractures into a permanent consensus fork between quorum-staging nodes and standard synchronization nodes.

Impact

  1. Unauthorized Escrow Theft: Any network account can hijack and refund third-party lease escrows to their own account during staged conflict elections.
  2. Bypass of Provider Protection / Premature Sashing: Consumers (or attackers) can force-settle leases without waiting for the grace period and force-settle gap, bypassing timekeeper attestations.
  3. Permanent Consensus Partition: Discrepancy between live block ingestion and staged block validation allows blocks violating protocol ownership to enter the ledger, causing follower nodes to permanently desynchronize.

Remediation

In core/ledger.go, update case BlockLeaseForceSettle in ValidateStagedBlock to verify asset type, source lease ownership, and lease state:

	case BlockLeaseForceSettle:
		if b.Asset != "XUSD" {
			return fmt.Errorf("staged lease_force_settle: asset must be XUSD")
		}
		leaseBlock, err := l.store.GetBlock(b.Source)
		if err != nil || leaseBlock == nil {
			return fmt.Errorf("staged lease_force_settle: source lease block not found")
		}
		if leaseBlock.Type != BlockLease {
			return fmt.Errorf("staged lease_force_settle: source block is not a lease block")
		}
		if leaseBlock.Account != b.Account {
			return fmt.Errorf("staged lease_force_settle: only consumer can force-settle lease")
		}
		lease, ok, err := l.getLeaseOverlay(b.Source)
		if !ok || err != nil || lease == nil {
			return fmt.Errorf("staged lease_force_settle: lease not found")
		}
		if lease.Settled || lease.State != LeaseAccepted {
			return fmt.Errorf("staged lease_force_settle: lease not in force-settleable state")
		}
		pending, err := l.store.GetPendingSend(b.Source)
		if err != nil || pending == nil {
			return fmt.Errorf("staged lease_force_settle: no pending escrow for lease")
		}
		expectedBal := parentBalance + pending.Amount
		if b.Balance != expectedBal {
			return fmt.Errorf("staged lease_force_settle: balance mismatch: expected %d, got %d", expectedBal, b.Balance)
		}

Thread

Joseph Denneteam2026-11-20 00:33 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-9786 and says what differs; it is read like any other.