{"id":"XE-17966","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":2260,"title":"[Re-report] XE-0661 still unfixed at HEAD 8cc209d: lease_cancel still lacks uint64 overflow guard","area":"leasing-ledger","claimed_tier":"high","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0003","tracked":true,"internal_ref":"#1101","internal_url":"https://github.com/xeprotocol/core/issues/1101","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-18T02:34:04.790144+00:00","updated_at":"2026-11-23T09:05:28.687589+00:00","source_created_at":null,"told_at":"2026-11-23T09:05:28.698748+00:00","status_changed_at":"2026-11-23T09:05:28.690865+00:00","url":"https://bounty.xe.network/XE-17966","body":"{\"title\": \"[Re-report] XE-0661 still unfixed at HEAD 8cc209d: lease_cancel still lacks uint64 overflow guard\", \"body\": \"# [Re-report] XE-0661 still unfixed at HEAD 8cc209d: validateAndAddLeaseCancel still lacks uint64 overflow check\\n\\n**Original ticket:** [XE-0661](https://bounty.xe.network/XE-0661) \\u2014 \\\"core: validateAndAddLeaseCancel computes expectedBal without overflow protection (High)\\\"\\n**Original status:** triaging (as of this filing)\\n**This report:** re-report \\u2014 the defect is still present at current HEAD. It is NOT a new bug. Filed in the style of XE-13265 ([Re-report] XE-0072 still unfixed).\\n\\n## Verified still broken at HEAD 8cc209d (\\\"release: testnet-0006 build\\\", 2026-11-16)\\n\\n`core/ledger.go`, `validateAndAddLeaseCancel` (now at **line 1987**, moved from 1853):\\n\\n```go\\noldBal := l.getAssetBalanceOverlay(b.Account, \\\"XCU\\\")\\nexpectedBal := oldBal + leaseBlock.Amount   // overflow not checked\\nif b.Balance != expectedBal {\\n    return fmt.Errorf(\\\"balance mismatch: expected %d, got %d\\\", expectedBal, b.Balance)\\n}\\n```\\n\\nNo `if expectedBal < oldBal` guard exists anywhere in this function.\\n\\n## The contrast is even sharper now\\n\\nThe sibling paths DO have the guard at the same HEAD:\\n\\n- `core/ledger.go:2346` \\u2014 `lease_settle would overflow uint64 balance`\\n- `core/ledger.go:2103` \\u2014 `lease_force_settle would overflow uint64 balance`\\n- `core/ledger.go:1203` \\u2014 `receive would overflow uint64 balance`\\n\\nLeaseCancel remains the sole balance-increasing path without overflow protection, exactly as XE-0661 described. The delta between original filing and now: the function moved lines (1853 \\u2192 1987) in the testnet-0006 build but the missing guard did not change.\\n\\n## What was checked to rule out an indirect fix\\n\\n- No clamp/saturating-add helper introduced: `grep -rn 'saturating\\\\|MaxUint64' core/ledger.go` \\u2014 no hits on the lease-cancel path.\\n- `getAssetBalanceOverlay` returns raw uint64; no wrap-detection upstream.\\n- Recent ledger.go commits (testnet-0006 build) touch settlement/quorum, not lease-cancel balance math.\\n\\n## Impact (unchanged from XE-0661)\\n\\nA lease-cancel block with `oldBal + Amount > MaxUint64` wraps and passes validation \\u2014 consumer receives a wrapped (incorrect) balance: double-spend-equivalent on the XCU accounting path.\\n\\n## Suggested fix (unchanged)\\n\\n```go\\nexpectedBal := oldBal + leaseBlock.Amount\\nif expectedBal < oldBal {\\n    return fmt.Errorf(\\\"lease_cancel would overflow uint64 balance\\\")\\n}\\n```\\n\", \"claimed_tier\": \"high\", \"area\": \"leasing-ledger\", \"references\": \"XE-0661\"}","patch_refs":[],"thread":[{"id":19735,"source":"desk","source_ref":"reply:17401","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0003, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-17966 and says what differs; it is read like any other.","created_at":"2026-11-23T09:05:28.687589+00:00"}]}