XE-9889 · Bounty
Unbounded State Inflation & OOM DoS: Directory.Register lacks map capacity limit permitting unauthenticated memory exhaustion
Closed · duplicate
—
web
filed 2026-11-12 08:04 UTC
by xe:e4cd6974
Report
Vulnerability Summary
In directory/directory.go:17-50, Directory manages peer routing registrations mapping accounts to libp2p peer addresses:
type Directory struct {
mu sync.RWMutex
registrations map[string]*Registration
ttl time.Duration
}
In directory/directory.go:35-50:
func (d *Directory) Register(reg *Registration) error {
if err := VerifyRegistration(reg); err != nil {
return err
}
d.mu.Lock()
defer d.mu.Unlock()
existing, ok := d.registrations[reg.Account]
if ok && existing.Timestamp >= reg.Timestamp {
return nil
}
d.registrations[reg.Account] = reg
return nil
}
Notice that:
Directory.Registeris publicly exposed via the unauthenticated HTTP API endpointPOST /directory/register(api/directory.go:11-23) and via P2P gossip.- Generating a valid
directory.Registrationrequires only generating an arbitrary ephemeral Ed25519 keypair in memory and signingcanonicalBytes. It requires zero native tokens, zero gas, zero on-chain transactions, and zero PoW! d.registrationshas NO capacity cap (no MaxRegistrations), no LRU eviction, and relies solely on passive periodic pruning (d.Prune(), which only evicts items older than 30 minutes).
Vulnerable Code Locations
directory/directory.go:35-50:Directory.Registerinserts new registrations directly intod.registrations[reg.Account]without checking any maximum map capacity or bounding overall memory usage.directory/verify.go:29-53:VerifyRegistrationchecks only cryptographic Ed25519 signature validity. It does not enforce proof-of-work, account on-chain existence, or rate limiting per IP/subnet.
Attack & Failure Scenario
- An unauthenticated attacker runs a simple script that generates ephemeral Ed25519 keypairs in a tight loop (~5,000 to 10,000 keys per second).
- For each keypair, the attacker sends a signed
directory.RegistrationtoPOST /directory/registeror floods the/xe/dir-gossip/1.0.0libp2p topic. - Every registration passes
VerifyRegistrationbecause the signature is mathematically valid for the newly generated ephemeral public key. - The node stores all incoming registrations into
d.registrations. - In less than 10 minutes, the attacker floods several million unique registration objects into memory (~1 GB to 4 GB of RAM), driving the node host into kernel Out of Memory (OOM) panic and terminating the node daemon!
Impact
- Remote Unauthenticated Node Crash (Denial of Service): Any external entity can trigger complete OOM node crashes across all network validators and seed nodes without spending gas or solving PoW.
- Directory Lookup Degradation:
Memory bloat degrades lookup performance and list pagination (
d.List()).
Remediation
Enforce a strict maximum capacity on d.registrations with FIFO / LRU eviction, and require minimum proof-of-work or an active on-chain account balance to register in the directory:
const MaxDirectoryEntries = 50000
func (d *Directory) Register(reg *Registration) error {
if err := VerifyRegistration(reg); err != nil {
return err
}
d.mu.Lock()
defer d.mu.Unlock()
if len(d.registrations) >= MaxDirectoryEntries {
d.pruneLocked()
if len(d.registrations) >= MaxDirectoryEntries {
return fmt.Errorf("directory full: maximum capacity reached")
}
}
existing, ok := d.registrations[reg.Account]
if ok && existing.Timestamp >= reg.Timestamp {
return nil
}
d.registrations[reg.Account] = reg
return nil
}
Thread
Joseph Denneteam2026-11-20 00:33 UTCdesk
Thanks. This is the same finding as https://bounty.xe.network/XE-0001, 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-9889 and says what differs; it is read like any other.