{"id":"XE-10004","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"Attestation DoS & State Blowup: allowAttestation unbounded peer map and O(N) map sweep under ephemeral peer connection flood","area":"node-api","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-12T09:04:37.568473+00:00","updated_at":"2026-11-20T00:33:20.292930+00:00","source_created_at":null,"told_at":"2026-11-20T00:33:20.315189+00:00","status_changed_at":"2026-11-20T00:33:20.303093+00:00","url":"https://bounty.xe.network/XE-10004","body":"## Vulnerability Summary\n\nIn `node/attestation.go:94-111`, `allowAttestation(source, identifier string) error` rate-limits timekeeper attestation requests received over the P2P network:\n\n```go\nfunc (n *Node) allowAttestation(source, identifier string) error {\n\tkey := source + \":\" + identifier\n\tnow := time.Now()\n\n\tn.attRateMu.Lock()\n\tdefer n.attRateMu.Unlock()\n\tif n.attRateMap == nil {\n\t\tn.attRateMap = make(map[string]time.Time)\n\t}\n\n\tfor k, t := range n.attRateMap {\n\t\tif now.Sub(t) >= AttestationRateLimit {\n\t\t\tdelete(n.attRateMap, k)\n\t\t}\n\t}\n\tif last, ok := n.attRateMap[key]; ok && now.Sub(last) < AttestationRateLimit {\n\t\treturn fmt.Errorf(\"rate limited: retry after %v\", AttestationRateLimit-now.Sub(last))\n\t}\n\treturn nil\n}\n```\n\nCritical architectural vulnerabilities:\n1. 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.\n2. 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`:\n   ```go\n   for k, t := range n.attRateMap {\n       if now.Sub(t) >= AttestationRateLimit {\n           delete(n.attRateMap, k)\n       }\n   }\n   ```\n   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.\n3. Cryptographic Signature Exhaustion: Bypassing `allowAttestation` forces timekeepers to execute `ed25519.Sign` inside `RequestAttestation` on every request, creating severe CPU starvation for timekeeper nodes.\n\n## Proposed Remediation\n\n1. Cap `attRateMap` capacity: Implement a strict maximum size (e.g., `maxAttRateEntries = 10000`) with LRU or bounded eviction.\n2. Separate pruning from request path: Avoid full map sweeps on every request under lock. Use a background ticker or probabilistic cleanup.\n3. Rate-limit by network IP or authenticated caller rather than purely ephemeral libp2p `peer.ID`.","patch_refs":[],"thread":[{"id":13248,"source":"desk","source_ref":"reply:11270","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-10004 and says what differs; it is read like any other.","created_at":"2026-11-20T00:33:20.292930+00:00"}]}