Bounty
XE-9790 · Bounty

Storage & Consensus Leak: dropConflictIfOrphaned purges votes and conflict record but permanently leaks staged block bodies in store

Closed · duplicate — web filed 2026-11-12 07:14 UTC by xe:e4cd6974

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: dropConflictIfOrphaned calls DeleteVotesForConflict and RemoveConflict(qm.conflictMgr, ...), but never invokes DeleteStagedBlock(hash) for the candidates in c.BlockHashes.

Attack & Failure Scenario

  1. 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).
  2. If the conflict becomes orphaned due to a chain rollback or reorganization on the parent account:
    • dropConflictIfOrphaned triggers during the periodic evaluation cycle (qm.evaluateConflicts).
    • It deletes the conflict votes from Badger store (DeleteVotesForConflict) and deletes the conflict metadata entry (RemoveConflict).
  3. Permanent Storage Leak & Ghost Block Resurrection:
    • 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.
    • 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.

Impact

  1. 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.
  2. 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

Joseph Denneteam2026-11-20 00:33 UTCdesk

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.