<!-- XE-10004 · Attestation DoS & State Blowup: allowAttestation unbounded peer map and O(N) map sweep under ephemeral peer connection flood · testnet -->
*Markdown view of <https://bounty.xe.network/XE-10004>. The page is the record; this is the same page for reading.*

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

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   Node / API

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:33 UTC

Told
:   2026-11-20 00:33 UTC

### Patches

None linked.

### History

- [552624](https://bounty.xe.network/log/552624) 2026-11-20 00:33 UTC proposal.adopted
- [552623](https://bounty.xe.network/log/552623) 2026-11-20 00:33 UTC reply.sent
- [552622](https://bounty.xe.network/log/552622) 2026-11-20 00:33 UTC ticket.status new → closed
- [552050](https://bounty.xe.network/log/552050) 2026-11-20 00:33 UTC proposal.adopted
- [552049](https://bounty.xe.network/log/552049) 2026-11-20 00:33 UTC ticket.facts area
- [552048](https://bounty.xe.network/log/552048) 2026-11-20 00:33 UTC proposal.adopted
- [552047](https://bounty.xe.network/log/552047) 2026-11-20 00:33 UTC ticket.facts
- [552046](https://bounty.xe.network/log/552046) 2026-11-20 00:33 UTC proposal.adopted
- [552045](https://bounty.xe.network/log/552045) 2026-11-20 00:33 UTC ticket.facts
- [550908](https://bounty.xe.network/log/550908) 2026-11-20 00:31 UTC note.added
- [550906](https://bounty.xe.network/log/550906) 2026-11-20 00:31 UTC proposal.created
- [550905](https://bounty.xe.network/log/550905) 2026-11-20 00:31 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-10004) · [JSON](https://bounty.xe.network/v1/tickets/XE-10004) · [markdown](https://bounty.xe.network/XE-10004.md)

### 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 Denne**team2026-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.
