{"id":"XE-13349","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"494","source_url":"https://github.com/xeprotocol/xe/issues/494","reporter_id":1981,"title":"Report bug","area":"consensus","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0028","tracked":true,"internal_ref":"#1094","internal_url":"https://github.com/xeprotocol/core/issues/1094","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:10.283142+00:00","updated_at":"2026-11-20T00:34:04.847581+00:00","source_created_at":"2026-11-12T03:18:23+00:00","told_at":"2026-11-20T00:33:18.968116+00:00","status_changed_at":"2026-11-20T00:33:18.954656+00:00","url":"https://bounty.xe.network/XE-13349","body":"# XE Bounty — Laporan siap file (temuan pass 3 #2)\n\nFile issue baru di: https://github.com/xeprotocol/xe/issues/new\nPaste judul + isi di bawah. Akun GitHub: Gib230223.\n\n---\n\n## Judul\n\n[Low] ValidateStagedBlock BlockLeaseSettle accepts any self-asserted Amount and any Asset\n\n## Isi\n\n## Summary\n\nIn `core/ledger.go`, the staged `BlockLeaseSettle` case in `ValidateStagedBlock` (~lines 2794–2807) checks only the uint64 overflow guard and the balance equation `b.Balance == parentBalance + b.Amount`. It never checks `b.Asset == \"XE\"`, never checks `b.Amount == LeaseTotalEmission(lease)`, and never checks that the lease exists, is Accepted, is expired, or has valid attestations. Full admission (`validateAndAddLeaseSettle`, `core/ledger.go:2117–2250`) requires all of those. So a staged settle with a forged Amount or a wrong Asset is staged-valid but full-invalid — the XE-0028 quorum-decoy pattern.\n\nThe settle case is the odd one out: the sibling staged cases anchor their amount to a real store value — staged `BlockReceive` (~2774) requires `b.Amount == pending.Amount`, staged `BlockLeaseCancel` / `BlockLeaseForceSettle` tie the balance to `pending.Amount`. Settle uses the block's own self-asserted `b.Amount` instead.\n\n## Evidence\n\n```go\n// core/ledger.go — staged BlockLeaseSettle case (~2794–2807)\npending, err := l.store.GetPendingSend(b.Source)\nif err != nil { return fmt.Errorf(\"staged lease_settle: GetPendingSend: %w\", err) }\nif pending == nil { return fmt.Errorf(\"staged lease_settle: no pending escrow for lease\") }\nexpectedBal := parentBalance + b.Amount\nif expectedBal < parentBalance {\n    return fmt.Errorf(\"staged lease_settle: balance would overflow uint64\")\n}\nif b.Balance != expectedBal {\n    return fmt.Errorf(\"staged lease_settle: balance mismatch: expected %d, got %d\", expectedBal, b.Balance)\n}\n// No check of b.Asset, no check of b.Amount against the lease.\n```\n\nFull admission requires what staging skips (`core/ledger.go`):\n- `:2119` — `lease_settle block must have asset=XE`\n- `:2070` `LeaseTotalEmission(lease)` + `:2174` / `:2183` — `lease_settle XE mismatch: expected %d (segments=%d, base cost=%d, R=%d), got %d`\n- lease.State must be LeaseAccepted; `ValidateAttestations` must pass; settleTime within [expiry, expiry+grace].\n\n## Impact (Low)\n\nStaged-valid / full-invalid quorum decoy. Reachable from normal balances (no 2^64 needed; any provider can forge a decoy settle for their own lease), but the attacker must be the account owner (provider) and full admission blocks the commit, so the impact is a chain-position stall / wasted quorum, not theft. Related note: the staged cancel/force_settle/accept cases also skip the Asset check (full admission requires Asset==\"XUSD\" for all three) — same class, different cases, not claimed here.\n\n## Reproduction (PoC)\n\nMemStore ledger, signed blocks (`core.SignBlock`, `ValidateStagedBlock`):\n```\nstaged lease_settle amount=1e12: ACCEPTED (nil error) — BUG\nstaged lease_settle amount=200: ACCEPTED (nil error) — BUG\nstaged lease_settle asset=XUSD: ACCEPTED (nil error) — BUG\nstaged lease_cancel (balance != parent+pending): REJECTED (staged lease_cancel: balance mismatch: expected 1200, got 1000999) — correct, amount is anchored\n```\nTwo different \"emissions\" (1e12 and 200) for one 200-unit escrow both pass staged validation; only one can be real. The Asset=\"XUSD\" settle would be rejected by full admission (\"lease_settle block must have asset=XE\").\n\n## Suggested fix\n\nIn the staged `BlockLeaseSettle` case, anchor the amount to the lease the way the sibling cases anchor to `pending.Amount`: require `b.Asset == \"XE\"` and `b.Amount == LeaseTotalEmission(lease)` (fetching the lease by `b.Source`), the same checks full admission already performs.\n\n## Novelty note\n\nNo ticket covers the staged settle Amount. Closest, all verified: XE-0028 (the general staged class, Accepted Medium); XE-5065 (scoped to overflow on cancel/force_settle + semantic checks for staged lease CREATE/ACCEPT only); XE-6782 (scoped to staged mint/burn/receive; its \"why not a duplicate\" section confirms the board treats each staged case family separately — the precedent this filing relies on); XE-2636/XE-7353 (cancel/force_settle overflow); GitHub #401 (empty-asset defaulting to XE in `core/quorum.go` promotable/confirmConflict — a different mechanism in a different function, about the asset default, not the Amount anchor); GitHub #52 (the general class). Checked the live bounty board (High+Medium and Minor views) and the GitHub repo issues, 2026-11-12.\n\nRepo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.\n","patch_refs":[{"id":568,"repo":"xeprotocol/xe","kind":"pr","ref":"522","title":"fix(core): validate asset, lease existence, and emission amount in staged BlockLeaseSettle (fixes #494)","url":"https://github.com/xeprotocol/xe/pull/522","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-11-14T20:42:20.213747+00:00"}],"thread":[{"id":13221,"source":"github","source_ref":"7026488475","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0028, 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-13349 and says what differs; it is read like any other.","created_at":"2026-11-20T00:34:54+00:00"}]}