<!-- XE-0661 · [Core/High] LeaseCancel balance overflow allows wrapped-balance double-spend — missing overflow check in validateAndAddLeaseCancel · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0661>. The page is the record; this is the same page for reading.*

XE-0661 · Bounty

# \[Core/High\] LeaseCancel balance overflow allows wrapped-balance double-spend — missing overflow check in validateAndAddLeaseCancel

Triaging
claimed High
web
filed 2026-11-05 10:21 UTC
by Ashev Ardiansyah

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   High

Area
:   Leasing / ledger

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-08 20:56 UTC

Told
:   2026-11-08 20:56 UTC

### Patches

None linked.

### History

- [45727](https://bounty.xe.network/log/45727) 2026-11-08 20:56 UTC reply.sent
- [45726](https://bounty.xe.network/log/45726) 2026-11-08 20:56 UTC proposal.adopted
- [45725](https://bounty.xe.network/log/45725) 2026-11-08 20:56 UTC proposal.adopted
- [45724](https://bounty.xe.network/log/45724) 2026-11-08 20:56 UTC ticket.status new → triaging
- [45723](https://bounty.xe.network/log/45723) 2026-11-08 20:56 UTC proposal.adopted
- [45722](https://bounty.xe.network/log/45722) 2026-11-08 20:56 UTC ticket.award
- [45721](https://bounty.xe.network/log/45721) 2026-11-08 20:56 UTC proposal.adopted
- [45720](https://bounty.xe.network/log/45720) 2026-11-08 20:56 UTC ticket.facts
- [45719](https://bounty.xe.network/log/45719) 2026-11-08 20:56 UTC proposal.adopted
- [45718](https://bounty.xe.network/log/45718) 2026-11-08 20:56 UTC ticket.facts
- [45717](https://bounty.xe.network/log/45717) 2026-11-08 20:56 UTC proposal.adopted
- [45716](https://bounty.xe.network/log/45716) 2026-11-08 20:56 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-0661) · [JSON](https://bounty.xe.network/v1/tickets/XE-0661) · [markdown](https://bounty.xe.network/XE-0661.md)

### Report

## Summary

`validateAndAddLeaseCancel` at `ledger.go:1853` computes `expectedBal := oldBal + leaseBlock.Amount` without overflow protection. Every other XUSD-increasing operation in the ledger (LeaseSettle at 1970, LeaseForceSettle at 1970, Mint at 68\) has an explicit `if expectedBal < oldBal` overflow check. LeaseCancel is the sole balance-increasing path missing this guard.

## Affected Code

```
// ledger.go:1853
expectedBal := oldBal + leaseBlock.Amount  // overflow not checked
if expectedBal != b.Balance {
    return fmt.Errorf(...)
}
```

## Impact

Block passes validation despite wrapping around uint64 max. The consumer account receives an incorrect (wrapped) balance instead of the correct `oldBal + escrowAmount`. This is a double-spend-equivalent: consumer gets both the escrow refund AND retains balance up to the wrap boundary.

## Reproduction

1. Create account with XUSD balance near MaxUint64
2. Cancel a lease with non-trivial escrow Amount
3. `oldBal + leaseBlock.Amount` overflows uint64 → small value
4. Craft `b.Balance` to match the wrapped value
5. Block is committed, consumer balance wraps

## Severity

High — financial integrity bug, balance manipulation vector.

## Fix

```
expectedBal := oldBal + leaseBlock.Amount
if expectedBal < oldBal {
    return fmt.Errorf("lease_cancel: balance overflow")
}
```

### Thread

**Joseph Denne**team2026-11-08 20:56 UTCdesk

Thanks for the report. We have confirmed the inconsistency you point out in the lease cancel validation and it is being handled. Note that the precondition is not reachable through accepted blocks today and the effect would not create funds, which is reflected in how we are treating it. We will update this ticket when a fix has shipped.
