Staged Block Validation Bypass: ValidateStagedBlock omits consumer authorization, lease state check, and asset verification on BlockLeaseCancel
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 BlockLeaseCancel is ingested normally through validateAndAddLeaseCancel (core/ledger.go:1792-1877), the node strictly verifies:
b.Asset == "XUSD"(core/ledger.go:1793-1795).leaseBlock.Account == b.Accountensuring only the original consumer can cancel their own lease (core/ledger.go:1809-1811).existing.State == LeaseCreated(orLeaseAcceptedwith resolve winner), explicitly forbidding cancelling settled, expired, or force-settled leases:if existing != nil && existing.State != LeaseCreated { return fmt.Errorf("cannot cancel lease in %s state", existing.State) }pending.Asset == "XUSD"matching the returned escrow balance.
However, in ValidateStagedBlock (core/ledger.go:2809-2820):
case BlockLeaseCancel:
pending, err := l.store.GetPendingSend(b.Source)
if err != nil {
return fmt.Errorf("staged lease_cancel: GetPendingSend: %w", err)
}
if pending == nil {
return fmt.Errorf("staged lease_cancel: no pending send for lease")
}
expectedBal := parentBalance + pending.Amount
if b.Balance != expectedBal {
return fmt.Errorf("staged lease_cancel: balance mismatch: expected %d, got %d", expectedBal, b.Balance)
}
Notice the critical omissions in ValidateStagedBlock for BlockLeaseCancel:
- 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 aBlockLeaseCancelreferencing 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, settled, or force-settled lease escrow can be cancelled and double-refunded during staged conflict resolution!
Vulnerable Code Locations
core/ledger.go:2809-2820:ValidateStagedBlockforBlockLeaseCancelchecks only thatl.store.GetPendingSend(b.Source)exists and matchesb.Balance == parentBalance + pending.Amount. It omits consumer ownership verification, lease state verification, and asset matching.
Attack & Failure Scenario
- Third-Party Escrow Theft / Unauthorized Refund:
- Alice creates a lease escrow of 10,000 XUSD (
b.Source). - Attacker Bob (competing in an open or contested block election on his account) creates a staged
BlockLeaseCancelcandidate referencing Alice's escrow hashb.Source. - When Bob's candidate is validated via
ValidateStagedBlock(candidate, parentBalance), the node checks:pending != nil(Alice's escrow exists in store).b.Balance == parentBalance + 10,000.
- Because
ValidateStagedBlockdoes not checkleaseBlock.Account == b.Account, Bob's block passes validation! - If Bob's block is promoted via quorum, Bob receives Alice's 10,000 XUSD escrow refund directly into his balance.
- Alice creates a lease escrow of 10,000 XUSD (
- Permanent Consensus Split / BFT Fork:
- Nodes ingesting the promoted block via standard peer sync (
validateAndAddLeaseCancel) checkleaseBlock.Account == b.Account. - Syncing nodes reject the block with
lease_cancel: only the consumer can cancel a lease. - 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.
- 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 BlockLeaseCancel in ValidateStagedBlock to verify asset type, source lease ownership, and lease state:
case BlockLeaseCancel:
if b.Asset != "XUSD" {
return fmt.Errorf("staged lease_cancel: asset must be XUSD")
}
leaseBlock, err := l.store.GetBlock(b.Source)
if err != nil || leaseBlock == nil {
return fmt.Errorf("staged lease_cancel: source lease block not found")
}
if leaseBlock.Type != BlockLease {
return fmt.Errorf("staged lease_cancel: source block is not a lease block")
}
if leaseBlock.Account != b.Account {
return fmt.Errorf("staged lease_cancel: only consumer can cancel lease")
}
if existing, ok, err := l.getLeaseOverlay(b.Source); ok && existing != nil {
if existing.State != LeaseCreated && existing.State != LeaseAccepted {
return fmt.Errorf("staged lease_cancel: cannot cancel lease in %s state", existing.State)
}
}
pending, err := l.store.GetPendingSend(b.Source)
if err != nil || pending == nil {
return fmt.Errorf("staged lease_cancel: no pending send for lease")
}
expectedBal := parentBalance + pending.Amount
if b.Balance != expectedBal {
return fmt.Errorf("staged lease_cancel: 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-9772 and says what differs; it is read like any other.