{"id":"XE-10307","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"Consensus Timing Race: ApplyGenesisLeaseTiming mutates package-level global variables corrupting concurrent consensus validation","area":"leasing-ledger","claimed_tier":null,"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-12T11:54:22.241514+00:00","updated_at":"2026-11-20T00:33:17.263732+00:00","source_created_at":null,"told_at":"2026-11-20T00:33:17.298878+00:00","status_changed_at":"2026-11-20T00:33:17.285585+00:00","url":"https://bounty.xe.network/XE-10307","body":"## Vulnerability Summary\n\nIn `core/ledger.go:155-186`, consensus lease timing constraints are declared as mutable package-level global variables:\n\n```go\nvar (\n\tLeaseMinDuration = DefaultLeaseMinDuration\n\tLeaseSettleGrace = DefaultLeaseSettleGrace\n\tLeaseForceSettleGap = DefaultLeaseForceSettleGap\n\tLeaseEscrowExpiry = DefaultLeaseEscrowExpiry\n\tLeaseArchiveGap = DefaultLeaseArchiveGap\n)\n\nfunc ApplyGenesisLeaseTiming(b *Block) {\n\tLeaseMinDuration = DefaultLeaseMinDuration\n\tLeaseSettleGrace = DefaultLeaseSettleGrace\n\tLeaseForceSettleGap = DefaultLeaseForceSettleGap\n\tLeaseEscrowExpiry = DefaultLeaseEscrowExpiry\n\tLeaseArchiveGap = DefaultLeaseArchiveGap\n\tMaxAttestationSkew = DefaultMaxAttestationSkew\n\tif b == nil {\n\t\treturn\n\t}\n\tif b.LeaseMinDurationSecs != 0 {\n\t\tLeaseMinDuration = b.LeaseMinDurationSecs\n\t}\n\tif b.LeaseSettleGraceNs != 0 {\n\t\tLeaseSettleGrace = b.LeaseSettleGraceNs\n\t}\n...\n```\n\nCritical architectural flaw:\n1. Global Shared State: `LeaseSettleGrace`, `LeaseForceSettleGap`, and `LeaseEscrowExpiry` are package globals rather than ledger-scoped or block-scoped fields.\n2. Non-Thread-Safe Mutexless Mutation: `ApplyGenesisLeaseTiming` mutates these variables without holding any synchronization lock.\n3. Consensus Divergence across Runtimes: When multiple ledger instances, tests, or simulator routines run concurrently with custom genesis blocks, calling `ApplyGenesisLeaseTiming` on one instance silently mutates validation constants across all running ledgers.\n4. Settle / Force-Settle Invalidation: In `validateAndAddLeaseForceSettle` (`core/ledger.go:1935`) and `validateAndAddLeaseSettle` (`core/ledger.go:2166`), calculations evaluate `expiry + LeaseSettleGrace + LeaseForceSettleGap`. If these global values are mutated or desynchronized during block evaluation, valid lease settlements and force-settlements fail consensus verification.\n\n## Proposed Remediation\n\nStore all timing parameters as immutable fields on the `Ledger` instance (`l.genesisTiming`) rather than package-level global variables, and read directly from `l.genesisTiming` during block validation.","patch_refs":[],"thread":[{"id":13192,"source":"desk","source_ref":"reply:11214","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, 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-10307 and says what differs; it is read like any other.","created_at":"2026-11-20T00:33:17.263732+00:00"}]}