Bounty
XE-10004 · Bounty

Attestation DoS & State Blowup: allowAttestation unbounded peer map and O(N) map sweep under ephemeral peer connection flood

Closed · duplicate — web filed 2026-11-12 09:04 UTC by xe:e4cd6974

Report

Vulnerability Summary

In node/attestation.go:94-111, allowAttestation(source, identifier string) error rate-limits timekeeper attestation requests received over the P2P network:

func (n *Node) allowAttestation(source, identifier string) error {
	key := source + ":" + identifier
	now := time.Now()

	n.attRateMu.Lock()
	defer n.attRateMu.Unlock()
	if n.attRateMap == nil {
		n.attRateMap = make(map[string]time.Time)
	}

	for k, t := range n.attRateMap {
		if now.Sub(t) >= AttestationRateLimit {
			delete(n.attRateMap, k)
		}
	}
	if last, ok := n.attRateMap[key]; ok && now.Sub(last) < AttestationRateLimit {
		return fmt.Errorf("rate limited: retry after %v", AttestationRateLimit-now.Sub(last))
	}
	return nil
}

Critical architectural vulnerabilities:

  1. Ephemeral Peer Bypass: In handleAttestationRequest, source is passed as from.String(), which is the caller's libp2p peer.ID. An attacker can generate ephemeral libp2p identities in milliseconds. Each connection generates a unique key = source + ":" + identifier, completely bypassing the AttestationRateLimit = 15s per-peer limit.
  2. Full Map Linear Sweep under Lock: On every incoming attestation request, the code holds n.attRateMu.Lock() and iterates through every entry in n.attRateMap:
    for k, t := range n.attRateMap {
        if now.Sub(t) >= AttestationRateLimit {
            delete(n.attRateMap, k)
        }
    }
    
    Under a flood of requests from distinct peer IDs, n.attRateMap inflates to tens of thousands of entries. Every request forces an O(N) linear iteration over the entire map while holding the exclusive lock, locking out all legitimate attestation requests.
  3. Cryptographic Signature Exhaustion: Bypassing allowAttestation forces timekeepers to execute ed25519.Sign inside RequestAttestation on every request, creating severe CPU starvation for timekeeper nodes.

Proposed Remediation

  1. Cap attRateMap capacity: Implement a strict maximum size (e.g., maxAttRateEntries = 10000) with LRU or bounded eviction.
  2. Separate pruning from request path: Avoid full map sweeps on every request under lock. Use a background ticker or probabilistic cleanup.
  3. Rate-limit by network IP or authenticated caller rather than purely ephemeral libp2p peer.ID.

Thread

Joseph Denneteam2026-11-20 00:33 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, 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-10004 and says what differs; it is read like any other.