{"id":"XE-0440","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":202,"title":"[Consensus] ValidateStagedBlock has no lease_renew case: a contested lease_renew is rejected at ingestion and can never be staged or promoted (Medium)","area":"consensus","claimed_tier":"medium","assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-04T09:14:49.017329+00:00","updated_at":"2026-11-05T22:10:49.356472+00:00","source_created_at":null,"told_at":"2026-11-05T22:10:49.535568+00:00","status_changed_at":"2026-11-05T22:10:49.507743+00:00","url":"https://bounty.xe.network/XE-0440","body":"# [Consensus] ValidateStagedBlock has no lease_renew case: a contested lease_renew is rejected at ingestion and can never be staged or promoted (Medium)\n\n**Repo pin:** `xeprotocol/xe` master @ `02e9641` (2026-11-03), network `testnet-0005`\n**Component:** `core/ledger.go` (`ValidateStagedBlock`), `core/quorum.go` (`promotable`,\n`confirmConflict`)\n**CWE:** CWE-754 (Improper Check for Unusual or Exceptional Conditions)\n**CVSS 3.1:** 4.7 Medium (retry-loss path) — `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L`;\nthe account-freeze variant of the same defect scores 8.2 High\n(`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L`).\n**Suggested tier:** Medium (2,500 XE), High if the team weights the freeze path.\n\n## Summary\n\n`BlockLeaseRenew` was wired into the protocol in the testnet-0005 lease-renewal work\n(`dispatchValidateAndAdd`, `blockDependencies`, `IsSpendingOp`, `MarshalBlockCanonical`,\n`buildBlockUndo`) but never into `ValidateStagedBlock`'s type switch (`core/ledger.go:2737-2872`),\nwhich falls through to `default: \"staged block: unknown type: lease_renew\"`.\n\nTwo reachable paths:\n\n1. `Ledger.addBlock` calls `ValidateStagedBlock` on any block that conflicts with an on-chain\n   sibling (`ledger.go:843`) **before** `recordConflict`/`SaveStagedBlock` — so a competing\n   `lease_renew` is rejected outright, no conflict is recorded, and the block is never staged.\n2. If a `lease_renew` ever reaches the staged set (it can, via `confirmConflict`'s\n   `SaveStagedBlock` of a demoted on-chain loser, `quorum.go:323`), `promotable()`\n   (`quorum.go:265`) and `confirmConflict` (`quorum.go:309`) both refuse it, so `pickWinner`\n   silently substitutes a different candidate.\n\n## Proof of concept\n\nSame drop-in bundle as the conflict-pollution report, run against a fresh clone at the pinned\ncommit:\n\n```\ngit clone https://github.com/xeprotocol/xe.git && cd xe && git checkout 02e9641\ncp zz_internal_test.go zz_verify_test.go core/\ngo test ./core/ -run TestConflictingLeaseRenewRejectedAtIngest -v\n```\n\nOutput (executed 2026-11-04):\n\n```\n=== RUN   TestConflictingLeaseRenewRejectedAtIngest\n2026/11/04 08:43:54 Genesis block applied: 42000000000000 XE to aa0f671c8610...\n    zz_verify_test.go:51: AddBlock(conflicting lease_renew) -> conflict block: staged block: unknown type: lease_renew\n    zz_verify_test.go:59: no conflict record created (renew dropped before recordConflict)\n    zz_verify_test.go:64: renew NOT staged -> can never win a conflict\n    zz_verify_test.go:74: AddBlock(conflicting send, control) -> <nil>\n    zz_verify_test.go:76: control send WAS staged (as expected)\n--- PASS: TestConflictingLeaseRenewRejectedAtIngest (0.00s)\n```\n\n## Impact\n\n- A lease renewal that competes with any block already on chain at the same height is dropped\n  outright and can never enter the conflict set, so it can never win even with 100% of final vote\n  weight — every other block type can.\n- A client that produces two competing renewals (retry after a broadcast failure — the failure\n  class already reported as XE-0197/XE-0102) permanently loses the second renewal: the lease keeps\n  the old, shorter expiry and is then force-settled/unfulfilled, burning the escrow and the\n  provider's reputation.\n- In path (2) the conflict can never be resolved, and since `addBlock` rejects all new blocks for\n  an account with an unresolved conflict record, that account is frozen.\n\n## Duplication check\n\nNot a duplicate of: XE-0097 (renew accepts any retained provider certificate), XE-0102\n(holdLease partial-minute abort), XE-0155 (client can never force-settle after a renewal),\nXE-0162 (LeaseAcceptPolicy not consulted for lease_renew), XE-0183 (no deterministic merge rule\nfor lease mutations), XE-0226 (renewed-lease reputation drop), XE-0042 (pickWinner substitution).\nAll different root causes; none is the missing switch case.\n\n## Suggested fix\n\nAdd a `case BlockLeaseRenew:` arm to `ValidateStagedBlock` mirroring the lease-family validation\nused by `validateAndAddLeaseRenew` (certificate freshness, policy caps, locked-emission terms),\nso a contested renewal can be staged and promoted like every other block type.","patch_refs":[],"thread":[{"id":190,"source":"web","source_ref":"reporter:202:b2031271832850cb","author":"xe:8dad6341","team":false,"body":"CVSS correction for XE-0440 (two variants) and clarification on freeze duration.\n\n**Corrected scores (re-computed from CVSS 3.1 spec):**\n\n- Drop/rejection variant: submitted 4.7 → correct **4.2**\n  `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L`\n  ISS = 1−(1−0)(1−0.22)(1−0.22) = 0.390; Impact = 6.42×0.390 = 2.504;\n  Exploit = 8.22×0.85×0.44×0.62×0.85 = 1.616; raw = 4.120; roundup = 4.2.\n\n- Freeze/account-lock variant: submitted 8.2 → correct **7.1**\n  `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L`\n  ISS = 1−(1−0)(1−0.56)(1−0.22) = 0.657; Impact = 6.42×0.657 = 4.218;\n  Exploit = 8.22×0.85×0.77×0.62×0.85 = 2.828; raw = 7.046; roundup = 7.1.\n\nThe operative variant for tier purposes is the freeze path (7.1, High band). The drop path\n(4.2) is the simpler trigger; the freeze path requires the `confirmConflict` / `SaveStagedBlock`\nroute.\n\n**Freeze duration — why the account cannot recover:**\n\nOnce `cleanupResolvedConflict` calls `DeleteStagedBlock(victim_hash)` and\n`rejectBlocks([victim_hash])`, the following applies permanently:\n\n1. `GetBlockOrStaged(victim_hash)` returns nil.\n2. `finalTally` (quorum.go:120-123) drops any vote whose block is not retrievable — so future\n   vote pulls for the victim's conflict position always return an empty tally. The 67% final-vote\n   threshold can never be assembled.\n3. `Ledger.addBlock` (ledger.go:815-818) rejects every new block submitted for an account with\n   an open conflict record. The victim cannot submit a replacement block.\n4. No background sweep re-stages deleted blocks. `confirmConflict` only promotes blocks already\n   in the staged set.\n\nThe account is permanently frozen absent a protocol-level rollback. If the victim's staged block\nwas a `lease_accept`, the pending escrow (XUSD) is permanently locked in the pending ID.\n\n**All block types are vulnerable:** `DeleteStagedBlock(hash)` is keyed on hash alone and is\nnot type-gated. A `lease_accept` victim has XUSD escrowed in `PendingID`; a `lease_open` victim\nhas XE locked for stake. The PoC uses a `send` block for simplicity; the attack applies equally\nto any block type.","created_at":"2026-11-04T09:45:33.598268+00:00"},{"id":429,"source":"desk","source_ref":"reply:156","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0276, 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, reply with what differs and we will look again.","created_at":"2026-11-05T22:10:49.356472+00:00"}]}