{"id":"XE-9790","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"Storage & Consensus Leak: dropConflictIfOrphaned purges votes and conflict record but permanently leaks staged block bodies in store","area":"consensus","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-13262","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-12T07:14:17.356699+00:00","updated_at":"2026-11-20T00:33:21.320123+00:00","source_created_at":null,"told_at":"2026-11-20T00:33:21.338642+00:00","status_changed_at":"2026-11-20T00:33:21.325452+00:00","url":"https://bounty.xe.network/XE-9790","body":"## Vulnerability Summary\n\nIn `core/quorum.go:451-468`, `dropConflictIfOrphaned(c *Conflict) bool` detects when a conflict election's chain position has been rolled back or superseded, and purges the conflict record and its associated votes from disk:\n\n```go\nfunc (qm *QuorumManager) dropConflictIfOrphaned(c *Conflict) bool {\n\tentry := qm.ledger.acquireAccountLock(c.AccountAddress)\n\tdefer qm.ledger.releaseAccountLock(c.AccountAddress, entry)\n\tif !qm.conflictOrphanedByRollback(c) {\n\t\treturn false\n\t}\n\tlog.Printf(\"quorum: dropping orphaned conflict %s|%s — its chain position was rolled back (a candidate is rejected and the parent is no longer on the canonical chain)\",\n\t\tshortHash(c.AccountAddress), shortHash(c.PreviousHash))\n\tif err := qm.store.DeleteVotesForConflict(c.AccountAddress, c.PreviousHash); err != nil {\n\t\tlog.Printf(\"quorum: DeleteVotesForConflict (orphan drop) for %s|%s: %v\",\n\t\t\tshortHash(c.AccountAddress), shortHash(c.PreviousHash), err)\n\t}\n\tRemoveConflict(qm.conflictMgr, c.AccountAddress, c.PreviousHash)\n\treturn true\n}\n```\n\nNotice that while `cleanupResolvedConflict` (`core/quorum.go:394-406`) explicitly loops through `result.WinnerHash` and all `result.LoserHashes` calling `qm.conflictMgr.DeleteStagedBlock(hash)`, **`dropConflictIfOrphaned` completely omits deleting the staged blocks (`c.BlockHashes`)**!\n\n---\n\n## Vulnerable Code Locations\n\n- `core/quorum.go:451-468`:\n  `dropConflictIfOrphaned` calls `DeleteVotesForConflict` and `RemoveConflict(qm.conflictMgr, ...)`, but never invokes `DeleteStagedBlock(hash)` for the candidates in `c.BlockHashes`.\n\n---\n\n## Attack & Failure Scenario\n\n1. During active consensus elections or forks, candidate block bodies competing in the conflict are saved to persistent disk storage under `prefixStaged` (`0x09`) via `cs.SaveStagedBlock(b)` (`core/ledger.go:860`).\n2. If the conflict becomes orphaned due to a chain rollback or reorganization on the parent account:\n   - `dropConflictIfOrphaned` triggers during the periodic evaluation cycle (`qm.evaluateConflicts`).\n   - It deletes the conflict votes from Badger store (`DeleteVotesForConflict`) and deletes the conflict metadata entry (`RemoveConflict`).\n3. **Permanent Storage Leak & Ghost Block Resurrection**:\n   - Because `DeleteStagedBlock` is never called for any hash in `c.BlockHashes`, all full candidate block bodies remain permanently written on disk in BadgerDB under `prefixStaged`.\n   - Over time, as nodes process conflicting network forks and reorgs, orphaned staged blocks accumulate indefinitely with no Garbage Collection (GC) or deletion path.\n   - Furthermore, because `GetBlockOrStaged` (`core/ledger.go:1072`) searches staged blocks when looking up blocks, these orphaned blocks can be resurrected as valid transaction sources or dependency parents for future invalid transactions, poisoning transaction dependency tracking.\n\n---\n\n## Impact\n\n1. **Unbounded Persistent Disk Exhaustion**:\n   Nodes leak full block payloads for every orphaned conflict candidate across the network life cycle. An attacker broadcasting discarded conflicting blocks can permanently bloat validator disk storage.\n2. **Ghost Dependency Poisoning**:\n   Orphaned staged blocks remain retrievable via `GetBlockOrStaged`, allowing transactions to bind against phantom unfinalized blocks whose conflict records were long discarded.\n\n---\n\n## Remediation\n\nIn `core/quorum.go`, update `dropConflictIfOrphaned` to delete all staged block payloads associated with the orphaned conflict:\n\n```go\nfunc (qm *QuorumManager) dropConflictIfOrphaned(c *Conflict) bool {\n\tentry := qm.ledger.acquireAccountLock(c.AccountAddress)\n\tdefer qm.ledger.releaseAccountLock(c.AccountAddress, entry)\n\tif !qm.conflictOrphanedByRollback(c) {\n\t\treturn false\n\t}\n\tlog.Printf(\"quorum: dropping orphaned conflict %s|%s — its chain position was rolled back\",\n\t\tshortHash(c.AccountAddress), shortHash(c.PreviousHash))\n\tif err := qm.store.DeleteVotesForConflict(c.AccountAddress, c.PreviousHash); err != nil {\n\t\tlog.Printf(\"quorum: DeleteVotesForConflict (orphan drop) for %s|%s: %v\",\n\t\t\tshortHash(c.AccountAddress), shortHash(c.PreviousHash), err)\n\t}\n\tfor _, h := range c.BlockHashes {\n\t\tif err := qm.conflictMgr.DeleteStagedBlock(h); err != nil {\n\t\t\tlog.Printf(\"quorum: DeleteStagedBlock (orphan drop) for %s: %v\", shortHash(h), err)\n\t\t}\n\t}\n\tRemoveConflict(qm.conflictMgr, c.AccountAddress, c.PreviousHash)\n\treturn true\n}\n```","patch_refs":[],"thread":[{"id":13262,"source":"desk","source_ref":"reply:11284","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-13262, 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-9790 and says what differs; it is read like any other.","created_at":"2026-11-20T00:33:21.320123+00:00"}]}