Staged Block Validation Bypass: ValidateStagedBlock omits consumer authorization, lease state check, and attestation verification on BlockLeaseForceSettle
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:
b.Asset == "XUSD"(core/ledger.go:1880-1882).leaseBlock.Account == b.Accountensuring only the original consumer can force-settle their own lease (core/ledger.go:1896-1898).!lease.Settled && lease.State == LeaseAccepted(core/ledger.go:1914-1922).- Timekeeper attestations verifying
forceTime >= eligibleAt(whereeligibleAt = expiry + LeaseSettleGrace + LeaseForceSettleGap) andforceTime < expiry + LeaseEscrowExpiry(core/ledger.go:1935-1946). - 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:
- Never checks
b.Asset == "XUSD": It allows arbitrary asset tags (e.g. mintingXEor cross-asset balance manipulation). - Never checks consumer authorization (
leaseBlock.Account == b.Account): Any third-party attacker account can stage aBlockLeaseForceSettlereferencing another user's lease escrow (b.Source) and steal the escrow amount into their own balance! - Never inspects lease state (
l.store.GetLease): An active, unexpired, or already settled lease can be prematurely force-settled during staged conflict resolution! - 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:ValidateStagedBlockforBlockLeaseForceSettlechecks only thatl.store.GetPendingSend(b.Source)exists and matchesb.Balance == parentBalance + pending.Amount. It omits consumer ownership verification, lease state verification, attestation verification, and asset matching.
Attack & Failure Scenario
- Third-Party Escrow Hijacking / Premature Force-Settle:
- Alice creates a lease escrow of 50,000 XUSD (
b.Source). - Attacker Bob creates a staged
BlockLeaseForceSettlecandidate referencing Alice's escrow hashb.Sourceon 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
ValidateStagedBlockdoes not checkleaseBlock.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.
- Alice creates a lease escrow of 50,000 XUSD (
- Permanent Consensus Split / BFT Fork:
- Nodes ingesting the promoted block via standard peer sync (
validateAndAddLeaseForceSettle) checkleaseBlock.Account == b.Accountand timekeeper attestations. - Syncing nodes reject the block with
lease_force_settle: only the consumer can force-settle a leaseorlease not yet force-settleable. - The network fractures into a permanent consensus fork between quorum-staging nodes and standard synchronization nodes.
- Nodes ingesting the promoted block via standard peer sync (
Impact
- Unauthorized Escrow Theft: Any network account can hijack and refund third-party lease escrows to their own account during staged conflict elections.
- 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.
- 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
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.