Bounty
XE-0440 · Bounty

[Consensus] ValidateStagedBlock has no lease_renew case: a contested lease_renew is rejected at ingestion and can never be staged or promoted (Medium)

Closed · duplicate —claimed Medium web filed 2026-11-04 09:14 UTC by xe:8dad6341

Report

[Consensus] ValidateStagedBlock has no lease_renew case: a contested lease_renew is rejected at ingestion and can never be staged or promoted (Medium)

Repo pin: xeprotocol/xe master @ 02e9641 (2026-11-03), network testnet-0005 Component: core/ledger.go (ValidateStagedBlock), core/quorum.go (promotable, confirmConflict) CWE: CWE-754 (Improper Check for Unusual or Exceptional Conditions) 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; the account-freeze variant of the same defect scores 8.2 High (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L). Suggested tier: Medium (2,500 XE), High if the team weights the freeze path.

Summary

BlockLeaseRenew was wired into the protocol in the testnet-0005 lease-renewal work (dispatchValidateAndAdd, blockDependencies, IsSpendingOp, MarshalBlockCanonical, buildBlockUndo) but never into ValidateStagedBlock's type switch (core/ledger.go:2737-2872), which falls through to default: "staged block: unknown type: lease_renew".

Two reachable paths:

  1. Ledger.addBlock calls ValidateStagedBlock on any block that conflicts with an on-chain sibling (ledger.go:843) before recordConflict/SaveStagedBlock — so a competing lease_renew is rejected outright, no conflict is recorded, and the block is never staged.
  2. If a lease_renew ever reaches the staged set (it can, via confirmConflict's SaveStagedBlock of a demoted on-chain loser, quorum.go:323), promotable() (quorum.go:265) and confirmConflict (quorum.go:309) both refuse it, so pickWinner silently substitutes a different candidate.

Proof of concept

Same drop-in bundle as the conflict-pollution report, run against a fresh clone at the pinned commit:

git clone https://github.com/xeprotocol/xe.git && cd xe && git checkout 02e9641
cp zz_internal_test.go zz_verify_test.go core/
go test ./core/ -run TestConflictingLeaseRenewRejectedAtIngest -v

Output (executed 2026-11-04):

=== RUN   TestConflictingLeaseRenewRejectedAtIngest
2026/11/04 08:43:54 Genesis block applied: 42000000000000 XE to aa0f671c8610...
    zz_verify_test.go:51: AddBlock(conflicting lease_renew) -> conflict block: staged block: unknown type: lease_renew
    zz_verify_test.go:59: no conflict record created (renew dropped before recordConflict)
    zz_verify_test.go:64: renew NOT staged -> can never win a conflict
    zz_verify_test.go:74: AddBlock(conflicting send, control) -> <nil>
    zz_verify_test.go:76: control send WAS staged (as expected)
--- PASS: TestConflictingLeaseRenewRejectedAtIngest (0.00s)

Impact

  • A lease renewal that competes with any block already on chain at the same height is dropped outright and can never enter the conflict set, so it can never win even with 100% of final vote weight — every other block type can.
  • A client that produces two competing renewals (retry after a broadcast failure — the failure class already reported as XE-0197/XE-0102) permanently loses the second renewal: the lease keeps the old, shorter expiry and is then force-settled/unfulfilled, burning the escrow and the provider's reputation.
  • In path (2) the conflict can never be resolved, and since addBlock rejects all new blocks for an account with an unresolved conflict record, that account is frozen.

Duplication check

Not a duplicate of: XE-0097 (renew accepts any retained provider certificate), XE-0102 (holdLease partial-minute abort), XE-0155 (client can never force-settle after a renewal), XE-0162 (LeaseAcceptPolicy not consulted for lease_renew), XE-0183 (no deterministic merge rule for lease mutations), XE-0226 (renewed-lease reputation drop), XE-0042 (pickWinner substitution). All different root causes; none is the missing switch case.

Suggested fix

Add a case BlockLeaseRenew: arm to ValidateStagedBlock mirroring the lease-family validation used by validateAndAddLeaseRenew (certificate freshness, policy caps, locked-emission terms), so a contested renewal can be staged and promoted like every other block type.

Thread

xe:8dad63412026-11-04 09:45 UTCweb

CVSS correction for XE-0440 (two variants) and clarification on freeze duration.

Corrected scores (re-computed from CVSS 3.1 spec):

  • Drop/rejection variant: submitted 4.7 → correct 4.2 CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L ISS = 1−(1−0)(1−0.22)(1−0.22) = 0.390; Impact = 6.42×0.390 = 2.504; Exploit = 8.22×0.85×0.44×0.62×0.85 = 1.616; raw = 4.120; roundup = 4.2.

  • Freeze/account-lock variant: submitted 8.2 → correct 7.1 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L ISS = 1−(1−0)(1−0.56)(1−0.22) = 0.657; Impact = 6.42×0.657 = 4.218; Exploit = 8.22×0.85×0.77×0.62×0.85 = 2.828; raw = 7.046; roundup = 7.1.

The operative variant for tier purposes is the freeze path (7.1, High band). The drop path (4.2) is the simpler trigger; the freeze path requires the confirmConflict / SaveStagedBlock route.

Freeze duration — why the account cannot recover:

Once cleanupResolvedConflict calls DeleteStagedBlock(victim_hash) and rejectBlocks([victim_hash]), the following applies permanently:

  1. GetBlockOrStaged(victim_hash) returns nil.
  2. finalTally (quorum.go:120-123) drops any vote whose block is not retrievable — so future vote pulls for the victim's conflict position always return an empty tally. The 67% final-vote threshold can never be assembled.
  3. Ledger.addBlock (ledger.go:815-818) rejects every new block submitted for an account with an open conflict record. The victim cannot submit a replacement block.
  4. No background sweep re-stages deleted blocks. confirmConflict only promotes blocks already in the staged set.

The account is permanently frozen absent a protocol-level rollback. If the victim's staged block was a lease_accept, the pending escrow (XUSD) is permanently locked in the pending ID.

All block types are vulnerable: DeleteStagedBlock(hash) is keyed on hash alone and is not type-gated. A lease_accept victim has XUSD escrowed in PendingID; a lease_open victim has XE locked for stake. The PoC uses a send block for simplicity; the attack applies equally to any block type.

Joseph Denneteam2026-11-05 22:10 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0276, 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.