Storage & Consensus Leak: dropConflictIfOrphaned purges votes and conflict record but permanently leaks staged block bodies in store
Report
Vulnerability Summary
In 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:
func (qm *QuorumManager) dropConflictIfOrphaned(c *Conflict) bool {
entry := qm.ledger.acquireAccountLock(c.AccountAddress)
defer qm.ledger.releaseAccountLock(c.AccountAddress, entry)
if !qm.conflictOrphanedByRollback(c) {
return false
}
log.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)",
shortHash(c.AccountAddress), shortHash(c.PreviousHash))
if err := qm.store.DeleteVotesForConflict(c.AccountAddress, c.PreviousHash); err != nil {
log.Printf("quorum: DeleteVotesForConflict (orphan drop) for %s|%s: %v",
shortHash(c.AccountAddress), shortHash(c.PreviousHash), err)
}
RemoveConflict(qm.conflictMgr, c.AccountAddress, c.PreviousHash)
return true
}
Notice 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)!
Vulnerable Code Locations
core/quorum.go:451-468:dropConflictIfOrphanedcallsDeleteVotesForConflictandRemoveConflict(qm.conflictMgr, ...), but never invokesDeleteStagedBlock(hash)for the candidates inc.BlockHashes.
Attack & Failure Scenario
- During active consensus elections or forks, candidate block bodies competing in the conflict are saved to persistent disk storage under
prefixStaged(0x09) viacs.SaveStagedBlock(b)(core/ledger.go:860). - If the conflict becomes orphaned due to a chain rollback or reorganization on the parent account:
dropConflictIfOrphanedtriggers during the periodic evaluation cycle (qm.evaluateConflicts).- It deletes the conflict votes from Badger store (
DeleteVotesForConflict) and deletes the conflict metadata entry (RemoveConflict).
- Permanent Storage Leak & Ghost Block Resurrection:
- Because
DeleteStagedBlockis never called for any hash inc.BlockHashes, all full candidate block bodies remain permanently written on disk in BadgerDB underprefixStaged. - Over time, as nodes process conflicting network forks and reorgs, orphaned staged blocks accumulate indefinitely with no Garbage Collection (GC) or deletion path.
- 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.
- Because
Impact
- Unbounded Persistent Disk Exhaustion: 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.
- Ghost Dependency Poisoning:
Orphaned staged blocks remain retrievable via
GetBlockOrStaged, allowing transactions to bind against phantom unfinalized blocks whose conflict records were long discarded.
Remediation
In core/quorum.go, update dropConflictIfOrphaned to delete all staged block payloads associated with the orphaned conflict:
func (qm *QuorumManager) dropConflictIfOrphaned(c *Conflict) bool {
entry := qm.ledger.acquireAccountLock(c.AccountAddress)
defer qm.ledger.releaseAccountLock(c.AccountAddress, entry)
if !qm.conflictOrphanedByRollback(c) {
return false
}
log.Printf("quorum: dropping orphaned conflict %s|%s — its chain position was rolled back",
shortHash(c.AccountAddress), shortHash(c.PreviousHash))
if err := qm.store.DeleteVotesForConflict(c.AccountAddress, c.PreviousHash); err != nil {
log.Printf("quorum: DeleteVotesForConflict (orphan drop) for %s|%s: %v",
shortHash(c.AccountAddress), shortHash(c.PreviousHash), err)
}
for _, h := range c.BlockHashes {
if err := qm.conflictMgr.DeleteStagedBlock(h); err != nil {
log.Printf("quorum: DeleteStagedBlock (orphan drop) for %s: %v", shortHash(h), err)
}
}
RemoveConflict(qm.conflictMgr, c.AccountAddress, c.PreviousHash)
return true
}
Thread
Thanks. This is the same finding as https://bounty.xe.network/XE-13262, 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, file a new report that links https://bounty.xe.network/XE-9790 and says what differs; it is read like any other.