Bounty
XE-0101 · Bounty

Live lease cancel destroys renewal escrow

Closed · duplicate —claimed High xe#158 filed 2026-10-29 02:44 UTC by 0xMissy22

Report

Live lease cancel destroys renewal escrow

Summary

Cancelling a renewed lease live refunds only the original lease cost while deleting the entire pending escrow (original cost plus renewals). The renewal funds are destroyed. Force-settle and staged cancel both refund the full pending amount, so the protocol contradicts itself: the same escrow is worth its full value on two exit paths and only its original value on the third.

Impact

Any consumer who cancels a renewed lease loses exactly the renewal sum. In the proof of concept, a lease of 40,000 micro-XUSD renewed once (+40,000, pending 80,000) cancels with a refund of 40,000 instead of 80,000 — 40,000 micro-XUSD destroyed through normal protocol use, with no attacker gain and no attacker required. A secondary consequence: a renewed-lease cancel can never satisfy both the live path (which demands the original-only balance) and the staged path (which demands the full pending) at once.

Suggested program tier: High (fund loss through normal use; not Critical — there is no theft and no attacker profit).

Root cause

  • core/ledger.go (live cancel): the expected balance is computed as the old balance plus the original lease amount only, while the commit deletes the whole pending entry for the lease source.
  • core/ledger.go (force-settle) and the staged-cancel path: refund the full pending amount.
  • core/lease_renew.go: renewals top up the same pending entry, so the original and renewal funds are indistinguishable by the time cancel runs.

Proof of concept

Target: xeprotocol/xe @ 978785929bc17a2f4ab30c383e5fc9cf4d634512 (2026-10-15). The harness runs against the real core and store packages via a replace directive; the repository itself is not modified.

Attached PoC: pocs/harness-slice1-main.go.txt (byte-identical copy of the runnable harness; the cancel case is the C2 section).

Run (Go 1.25.14):

export PATH="$HOME/.local/go/bin:$PATH"
cd harness-slice1
GOPROXY=off go run .

Observed output (verbatim):

original cost=40000 renewal cost=40000 escrow pending=80000
cancel with FULL pending refund err=balance mismatch: expected 9960000, got 10000000 (expect balance mismatch)
cancel with ORIGINAL-only refund err=<nil>
consumer XUSD before=9920000 after=9960000 delta=40000 (pending refunded would be 80000)
escrow pending after cancel: <nil> (nil = deleted)
DESTROYED renewal escrow = 40000

A cancel claiming the full 80,000 pending is rejected by the balance check; a cancel claiming only the original 40,000 succeeds, and the remaining 40,000 vanishes with the deleted pending entry.

Reproduction steps

  1. Create and accept a lease (cost 40,000 micro-XUSD), then renew it once (+40,000).
  2. Submit a live lease_cancel block with balance = old balance + 40,000.
  3. Observed: succeeds, renewal 40,000 gone. Submitting with old balance + 80,000 is rejected.

Recommended fix

Live cancel must refund the full pending amount, like force-settle and staged cancel do, or the pending entry must be split so renewals survive a cancel.

Severity

  • CVSS 3.1: 7.5 — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
  • CWE-682 (Incorrect Calculation)

Caveats

  • Related public report, distinct mechanism: public issue #4 (F3) covers force-settle accounting, supply conservation, per-lease locking, and conflict staging for renewals. It does not cover the live-cancel refund path (different handler, different formula). This finding is the live-cancel path only, and the distinction is stated here so triage can judge it.
  • This reproduction runs against the repository code at the stated HEAD. No testnet transactions were sent as part of this report.

Payout address (XE): eff2c51dd8457df740b919226cd9b37a2944e5abea7501094db80234f87f010e

Best, Chaplin

harness-slice1-main.go.txt

Thread

fangjian-bit2026-10-29 05:54 UTCgithub

Submitted fix and regression test in #171.

Root cause was expectedBal := oldBal + leaseBlock.Amount in validateAndAddLeaseCancel, which only refunded the initial lease amount while deleting the entire pending escrow (DeletePendingID), effectively destroying renewal top-ups. Fixed to refund pending.Amount and added end-to-end verification in core/lease_cancel_test.go.

Joseph Denneteam2026-11-05 22:11 UTCgithub

Thanks. This is the same finding as https://bounty.xe.network/XE-0067, 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, reply with what differs and we will look again.