Bounty
XE-17966 · Bounty

[Re-report] XE-0661 still unfixed at HEAD 8cc209d: lease_cancel still lacks uint64 overflow guard

Closed · duplicate —claimed High web filed 2026-11-18 02:34 UTC by xe:a2b14c2a

Report

{"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\nOriginal ticket: XE-0661 \u2014 "core: validateAndAddLeaseCancel computes expectedBal without overflow protection (High)"\nOriginal status: triaging (as of this filing)\nThis 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\ncore/ledger.go, validateAndAddLeaseCancel (now at line 1987, moved from 1853):\n\ngo\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\ngo\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"}

Thread

Joseph Denneteam2026-11-23 09:05 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0003, 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-17966 and says what differs; it is read like any other.