{"id":"XE-0661","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":242,"title":"[Core/High] LeaseCancel balance overflow allows wrapped-balance double-spend — missing overflow check in validateAndAddLeaseCancel","area":"leasing-ledger","claimed_tier":"high","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":null,"status":"triaging","closed_reason":null,"github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-05T10:21:29.578406+00:00","updated_at":"2026-11-08T20:56:39.602097+00:00","source_created_at":null,"told_at":"2026-11-08T20:56:39.608123+00:00","status_changed_at":"2026-11-08T20:56:34.094405+00:00","url":"https://bounty.xe.network/XE-0661","body":"## Summary\n`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.\n\n## Affected Code\n```go\n// ledger.go:1853\nexpectedBal := oldBal + leaseBlock.Amount  // overflow not checked\nif expectedBal != b.Balance {\n    return fmt.Errorf(...)\n}\n```\n\n## Impact\nBlock 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.\n\n## Reproduction\n1. Create account with XUSD balance near MaxUint64\n2. Cancel a lease with non-trivial escrow Amount\n3. `oldBal + leaseBlock.Amount` overflows uint64 → small value\n4. Craft `b.Balance` to match the wrapped value\n5. Block is committed, consumer balance wraps\n\n## Severity\nHigh — financial integrity bug, balance manipulation vector.\n\n## Fix\n```go\nexpectedBal := oldBal + leaseBlock.Amount\nif expectedBal < oldBal {\n    return fmt.Errorf(\"lease_cancel: balance overflow\")\n}\n```","patch_refs":[],"thread":[{"id":1251,"source":"desk","source_ref":"reply:792","author":"Joseph Denne","team":true,"body":"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.","created_at":"2026-11-08T20:56:39.602097+00:00"}]}