{"id":"XE-8797","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":1930,"title":"ValidateStagedBlock admits lease_accept blocks with no timekeeper attestations and lease_settle blocks with an arbitrary emission amount — both are then treated as finalisable winners","area":"consensus","claimed_tier":"medium","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":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-12T00:58:16.582864+00:00","updated_at":"2026-11-20T00:04:29.537608+00:00","source_created_at":null,"told_at":"2026-11-20T00:04:29.588630+00:00","status_changed_at":"2026-11-20T00:04:29.556786+00:00","url":"https://bounty.xe.network/XE-8797","body":"# ValidateStagedBlock admits lease_accept blocks with no timekeeper attestations and lease_settle blocks with an arbitrary emission amount — both are then treated as finalisable winners\n\n- **Repo / HEAD:** github.com/xeprotocol/xe @ `89a542ea51d38375299aee54c6c99102e9bfa666` (testnet-0005)\n- **Class:** validation-skipping sibling path (conflict staging vs full admission), same family as XE-1968 / XE-7366 / XE-7367 but different object types and different skipped checks (see Dedupe).\n- **Suggested tier: Medium** (ceiling 2,500 XE) — reasoning at the end; a Minor assessment is plausible.\n\n## Summary\n\nWhen a signed block conflicts with an existing block at the same account position, `Ledger.addBlock` does not run the full per-type validator (`dispatchValidateAndAdd`). It runs the much weaker `ValidateStagedBlock` (`core/ledger.go:2732`) and, on success, stores the block as a conflict candidate and returns `nil` (success). The quorum layer then uses *only* `ValidateStagedBlock` to decide whether a winning candidate is promotable (`QuorumManager.promotable`, `core/quorum.go:260`), and vote weight for it is tallied normally. Full validation is only attempted at promotion time (`confirmConflict` → `SwapBlock`/`appendStagedWinner` → `dispatchValidateAndAdd`), where these blocks deterministically fail — so the position withholds finality instead of finalising the honest sibling.\n\nFor two lease types the staged/full gap is not a nuance but the entire security content of the block type:\n\n### 1. `lease_accept` — attestations, stake, certificate and locked-emission checks all skipped\n\nFull path — `validateAndAddLeaseAccept` (`core/ledger.go:1607`) requires, among other things:\n\n```go\nexpectedStake := LeaseStake(leaseBlock.Amount)\nif b.Amount != expectedStake {\n    return fmt.Errorf(\"lease_accept stake mismatch: expected %d, got %d\", expectedStake, b.Amount)\n}\n...\nstartTime, err := ValidateAttestations(b.Attestations, b.Source, tkConfig, skipSkew)\nif err != nil {\n    return fmt.Errorf(\"lease_accept attestation: %w\", err)\n}\n...\nif leaseBlock.CertificateHash != b.CertificateHash { ... }\ncertInfo := l.certificateLookupFn(b.CertificateHash)   // must exist, provider must match, startTime <= ExpiresAt\n...\nif lockedR == 0 { return fmt.Errorf(\"lease_accept missing locked emission params...\") }\nif err := l.validateLockedEmissionAt(startTime, lockedR, lockedCap, lockedTWAP, skipSkew, \"lease_accept\"); err != nil { return err }\n```\n\n(plus asset == XUSD, source block exists and is a lease, provider == lease destination, lease still in `LeaseCreated` state.)\n\nStaged path — `ValidateStagedBlock`, `core/ledger.go:2786`, the complete check set for the same object:\n\n```go\ncase BlockLeaseAccept:\n    if b.Amount > parentBalance {\n        return fmt.Errorf(\"staged lease_accept: insufficient balance: have %d, need %d\", parentBalance, b.Amount)\n    }\n    if b.Balance != parentBalance-b.Amount {\n        return fmt.Errorf(\"staged lease_accept: balance mismatch: expected %d, got %d\", parentBalance-b.Amount, b.Balance)\n    }\n```\n\nNo `ValidateAttestations` call (the block may carry **zero** attestations — the timekeeper-quorum proof of the lease start time is the whole point of this block type), no stake equality (any `Amount ≤ parentBalance` with matching balance arithmetic passes), no certificate binding, no locked-emission check, no lease-state or provider check.\n\n### 2. `lease_settle` — emission amount is self-certified in the staged path\n\nFull path — `validateAndAddLeaseSettle` (`core/ledger.go:2117`) requires asset == XE, lease exists and is in `LeaseAccepted` state, `lease.Provider == b.Account`, a valid timekeeper attestation median inside `[expiry, expiry+LeaseSettleGrace]`, and:\n\n```go\nexpectedXE, err := LeaseTotalEmission(lease)\n...\nif b.Amount != expectedXE {\n    return fmt.Errorf(\"lease_settle XE mismatch: expected %d (segments=%d, base cost=%d, R=%d), got %d\", ...)\n}\n```\n\nStaged path — `core/ledger.go:2793`, the complete check set:\n\n```go\ncase BlockLeaseSettle:\n    pending, err := l.store.GetPendingSend(b.Source)\n    if err != nil { ... }\n    if pending == nil {\n        return fmt.Errorf(\"staged lease_settle: no pending escrow for lease\")\n    }\n    expectedBal := parentBalance + b.Amount\n    if expectedBal < parentBalance { ... overflow ... }\n    if b.Balance != expectedBal {\n        return fmt.Errorf(\"staged lease_settle: balance mismatch: expected %d, got %d\", expectedBal, b.Balance)\n    }\n```\n\n`expectedBal` is derived from `b.Amount` itself, so **any** amount passes as long as an escrow is pending: a settle claiming 1 XE or 10⁹ XE for the same lease is equally \"valid\" to the staged validator. Asset is not checked either (the pre-staging gate in `addBlock` only requires *some* valid asset, XE or XUSD), nor are provider, lease state, or the attestation window.\n\n## The invalid objects (concrete constructions)\n\nBoth are built the same way: the attacker needs one ordinary block already on an account chain at position *P*, then signs a second block with the same `Previous`. The second block is routed to staging by `detectConflictSibling` (`core/conflict.go:40`, called at `core/ledger.go:812`).\n\n- **Phantom accept:** provider account with parent XUSD balance *B*. Sign a `lease_accept` at a position where a sibling already sits, with `Source` = any real lease hash, `Amount` = *B* (entire balance, not `LeaseStake(lease.Amount)`), `Balance` = 0, `Attestations` = empty, `CertificateHash` = empty, `LockedR` = 0. `VerifyBlock`/`verifyBlockCredential` pass (valid own signature; see actor note), the global checks in `addBlock` pass (PoW if enabled, timestamp window, asset XUSD), and `ValidateStagedBlock` accepts it. It is saved via `SaveStagedBlock`, a conflict is recorded, and representatives are asked to vote on it.\n- **Phantom settle:** provider account, lease with a live escrow pending. Sign a `lease_settle` at a conflicting position with `Asset` = \"XUSD\" (full path demands XE), `Amount` = any value *X*, `Balance` = parentBalance + *X*, no attestations. Staged-accepted the same way.\n\n## Trigger actor\n\nAny account holder who can sign for the account position — and, notably, **a single co-signer of a multisig account**: `IsSpendingOp` (`core/multisig.go:140`) does not list `lease_accept` or `lease_settle`, so `verifyBlockCredential` (run before staging, `core/ledger.go:~800`, and again inside `ValidateStagedBlock:2735`) verifies them with `VerifyMultisigAny` — one of N keyset signatures is enough to stage the phantom block on a threshold account. (The 1-of-N classification itself is XE-0001's claim; the new point here is what that one signature can stage.) No DAO keys, no operator access, no victim key material needed. Cost: one PoW (when difficulty is on) and a self-inflicted conflict on the position.\n\n## Downstream consequence (traced)\n\n1. The phantom enters the conflict candidate set (`recordConflict`, `SaveStagedBlock`, `addBlock` returns `nil`).\n2. Representatives' vote managers consider staged blocks as candidates (`GetBlockOrStaged` in `core/finalization.go` / `finalTally`), and votes for it accumulate weight normally.\n3. `QuorumManager.promotable` (`core/quorum.go:240-261`) gates finalisation on `ValidateStagedBlock(staged, parentBalance) == nil` only — the phantom *is* \"promotable\" by the code's own definition.\n4. If it reaches ≥67% of final-vote weight, `pickWinner` selects it and `confirmConflict` tries promotion: `SwapBlock → dispatchValidateAndAdd` (or `appendStagedWinner → dispatchValidateAndAdd`) runs the full validator, which deterministically rejects it (no attestations / stake mismatch / amount ≠ `LeaseTotalEmission`). `confirmConflict` records a failed promotion, quarantines it for only `failedPromotionTTL` = 30 s (`core/quorum.go:38`), and — per the code's own log line — *\"no other candidate is substituted\"*: the honest sibling is **not** finalised in its place.\n5. After 30 s the phantom is promotable again; the stale-conflict sweep (`sweepStaleConflicts`, every 15 s) re-tallies and re-attempts indefinitely. The account position never finalises while representatives keep weight on the phantom (their preference logic does not full-validate either), and everything downstream of that position stalls: subsequent blocks on the account cannot finalise past it, and cross-account flows referencing it (a consumer's lease whose accept/settle sits at the frozen position, receives against a contested send on it — cf. the contested-source deferral in `validateAndAddReceive`) are stuck with it.\n\nThis is a finality-withholding / liveness break for the targeted account position, reachable at the cost of one signature — not a balance corruption: promotion-time full validation does hold, and this report does not claim the phantom can be committed to the canonical chain.\n\n## Same-family gaps noted (not separately filed)\n\nFor completeness, the same function also skips, relative to the full validators: staged `lease` — certificate existence/provider/expiry, `ValidateLeaseDimensions`, cost equality (`Amount == LeaseCost(...)`), asset == XUSD, destination sanity; staged `send`/`burn` — `ValidateMemo`; staged `mint` — source/destination/memo emptiness; staged `lease_cancel`/`lease_force_settle` — consumer-only, lease-state and (for force-settle) attestation eligibility window. These have the same withholding-shaped impact and are listed here so the fix can be made uniformly (staged validation should reuse the full validators' side-effect-free checks).\n\n## Suggested fix\n\nIn `ValidateStagedBlock`, for `lease_accept` add: source lease exists and is a lease, provider/state consistency against the parent position, `Amount == LeaseStake(lease.Amount)`, `ValidateAttestations(...)` (with the staged path's skew policy), certificate-hash equality with the lease block, and `LockedR != 0` + `validateLockedEmissionAt`. For `lease_settle` add: asset == XE, provider/lease-state consistency, and `Amount == LeaseTotalEmission(lease)` computed from the lease record (not from `b.Amount`). More generally, gate `promotable()` on the same checks promotion will run, so an unpromotable candidate cannot win a tally.\n\n## Dedupe evidence\n\n- **XE-1968** is statechain *genesis* ops skipping `ValidateOp` — different object (statechain genesis), different check. Not this.\n- **XE-7366** is staged *multisig_update* accepting an invalid *keyset* that full admission rejects. Different object type and different skipped check.\n- **XE-7367** is `ValidateStagedBlock` never checking *timestamp monotonicity*. Different skipped check; this report's objects would pass even with a perfectly monotonic timestamp.\n- **xeprotocol/xe issue #8, Finding 2** claims the staged *receive* asset mismatch (`b.Asset == pendingAsset`) — a different object type and check; not re-reported here (verified still present at HEAD, deliberately excluded).\n- **xeprotocol/xe issue #4, Finding 3.3** claims staged *lease_renew* is missing entirely (valid renews rejected). Different object and opposite direction; not re-reported.\n- Recon classes checked: 2 (quorum/finality — this is a new *cause* of withholding: lease-type staged validation, not a tally/finalTally bug), 6 (multisig — only the staging surface is new), 7 (lease lifecycle — no title in the class covers staged accept/settle validation), 9, 11, 14, 16 (no overlap). Board title search for `ValidateStagedBlock`, `staged lease_accept`, `staged lease_settle` returned no matching ticket (search index is partial; held Severe tickets are not publicly visible — residual hidden-duplicate risk is inherent to the board).\n\n## Tier reasoning\n\nMedium (ceiling 2,500 XE). For: remotely triggerable by any account holder (or one multisig co-signer), no privileged keys; breaks finality for a real account position indefinitely and repeatably, with cross-account fallout for lease counterparties; the skipped checks are the core security content of the two block types (timekeeper quorum, emission amount). Against a higher tier: promotion-time full validation prevents any invalid state from being committed — impact is liveness, not theft or supply corruption — and creating the conflict requires signing against one's own (or one's shared) account position. That profile matches the board's Medium band; if the team weighs single-position withholding as local-only, Minor is the fallback.","patch_refs":[],"thread":[{"id":12665,"source":"desk","source_ref":"reply:10687","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-8797 and says what differs; it is read like any other.","created_at":"2026-11-20T00:04:29.537608+00:00"}]}