{"id":"XE-9728","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"Staged Block Validation Bypass: ValidateStagedBlock omits lease state, provider authorization, and emission verification on BlockLeaseSettle","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":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-12T06:44:44.648393+00:00","updated_at":"2026-11-20T00:33:19.063702+00:00","source_created_at":null,"told_at":"2026-11-20T00:33:19.089624+00:00","status_changed_at":"2026-11-20T00:33:19.070674+00:00","url":"https://bounty.xe.network/XE-9728","body":"## Vulnerability Summary\n\nIn `core/ledger.go:2732-2870`, `ValidateStagedBlock(b *Block, parentBalance uint64) error` performs consensus validation on candidate blocks competing in BFT quorum elections before staging or promotion to the canonical ledger.\n\nWhen `BlockLeaseSettle` is validated during normal block ingestion (`validateAndAddLeaseSettle`, `core/ledger.go:2117-2184`), the node strictly verifies:\n1. `b.Asset == \"XE\"` (`core/ledger.go:2118-2119`).\n2. `lease.Provider == b.Account` (`core/ledger.go:2134-2136`).\n3. `!lease.Settled` and `lease.State == LeaseAccepted` (`core/ledger.go:2131-2144`).\n4. `settleTime >= expiry` and `settleTime <= expiry+LeaseSettleGrace` via timekeeper attestations (`core/ledger.go:2158-2172`).\n5. `expectedXE, err := LeaseTotalEmission(lease); if b.Amount != expectedXE { return fmt.Errorf(\"lease_settle: ...\") }` (`core/ledger.go:2174-2178`).\n\nHowever, in `ValidateStagedBlock` (`core/ledger.go:2793-2808`):\n```go\n\tcase BlockLeaseSettle:\n\t\tpending, err := l.store.GetPendingSend(b.Source)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: GetPendingSend: %w\", err)\n\t\t}\n\t\tif pending == nil {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: no pending escrow for lease\")\n\t\t}\n\t\texpectedBal := parentBalance + b.Amount\n\t\tif expectedBal < parentBalance {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: balance would overflow uint64\")\n\t\t}\n\t\tif b.Balance != expectedBal {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: balance mismatch: expected %d, got %d\", expectedBal, b.Balance)\n\t\t}\n```\n\nNotice that `ValidateStagedBlock` for `BlockLeaseSettle`:\n1. **Never checks `b.Asset == \"XE\"`**: It allows arbitrary asset tags (e.g. minting `XUSD`).\n2. **Never loads the lease record (`l.store.GetLease`)**: It checks `l.store.GetPendingSend(b.Source)`, which only verifies that an escrow exists!\n3. **Never verifies `b.Amount == expectedXE`**: An attacker can set `b.Amount` to any arbitrary uint64 value (e.g. 100,000,000 XE) as long as `b.Balance == parentBalance + b.Amount`!\n4. **Never verifies `lease.Provider == b.Account`**: Any non-provider account can settle the lease!\n5. **Never verifies lease expiration or attestations**: An unexpired or unaccepted lease can be settled instantly!\n\n---\n\n## Vulnerable Code Locations\n\n- `core/ledger.go:2793-2808`:\n  `ValidateStagedBlock` for `BlockLeaseSettle` verifies only that `b.Source` exists in `PendingSend` and that `b.Balance == parentBalance + b.Amount`. It completely omits asset verification, provider identity check, emission computation, and lease expiration checks.\n\n---\n\n## Attack & Failure Scenario\n\n1. **Arbitrary XE Minting / Emission Inflation via Quorum**:\n   - A rogue node (or compromised provider) generates a conflicting `BlockLeaseSettle` candidate for an active lease escrow.\n   - The attacker sets `b.Amount = 50,000,000,000` (50 billion XE) instead of the legitimate emission of ~100 XE, and sets `b.Balance = parentBalance + 50,000,000,000`.\n   - In a quorum election for that provider's account, representative nodes invoke `ValidateStagedBlock(candidate, parentBalance)`.\n   - `ValidateStagedBlock` confirms `pending != nil` and `b.Balance == parentBalance + b.Amount`. The block passes validation and is accepted into `stagedStore`!\n   - If promoted via `confirmConflict` / `swapBlockLocked`, the provider's canonical balance is inflated by 50 billion XE without any attestation or emission verification!\n2. **Permanent Consensus Split / Network Partition**:\n   - Nodes receiving the block via normal gossip/sync ingest it through `validateAndAddLeaseSettle`.\n   - `validateAndAddLeaseSettle` computes `LeaseTotalEmission(lease)` and checks attestations, immediately failing with:\n     `lease cost mismatch: expected 100, got 50000000000`.\n   - The network splits: the staging nodes accept the block as valid consensus winner, while all syncing nodes reject it, creating an irreconcilable consensus partition!\n\n---\n\n## Impact\n\n1. **Unbounded Native Token Minting / Economic Collapse**:\n   Attackers can claim arbitrarily large XE emission payouts during staged block conflict resolution, minting unbacked XE tokens.\n2. **Permanent Consensus Split / BFT Fork**:\n   Divergence between `ValidateStagedBlock` and `validateAndAddLeaseSettle` breaks consensus determinism across network nodes.\n\n---\n\n## Remediation\n\nIn `core/ledger.go`, update `case BlockLeaseSettle` in `ValidateStagedBlock` to verify the asset, lease record, provider authorization, and emission amount:\n```go\n\tcase BlockLeaseSettle:\n\t\tif b.Asset != \"XE\" {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: asset must be XE\")\n\t\t}\n\t\tlease, ok, err := l.getLeaseOverlay(b.Source)\n\t\tif !ok || err != nil || lease == nil {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: lease not found\")\n\t\t}\n\t\tif lease.Provider != b.Account {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: provider mismatch\")\n\t\t}\n\t\texpectedXE, err := LeaseTotalEmission(lease)\n\t\tif err != nil || b.Amount != expectedXE {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: emission mismatch: expected %d, got %d\", expectedXE, b.Amount)\n\t\t}\n\t\texpectedBal := parentBalance + b.Amount\n\t\tif expectedBal < parentBalance {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: balance would overflow uint64\")\n\t\t}\n\t\tif b.Balance != expectedBal {\n\t\t\treturn fmt.Errorf(\"staged lease_settle: balance mismatch: expected %d, got %d\", expectedBal, b.Balance)\n\t\t}\n```","patch_refs":[],"thread":[{"id":13224,"source":"desk","source_ref":"reply:11246","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-9728 and says what differs; it is read like any other.","created_at":"2026-11-20T00:33:19.063702+00:00"}]}