Inbound sync handler CPU DoS: per-peer cooldown limiter bypassable with unlimited peer IDs; no concurrency cap on inbound sync streams
Report
Severity: High (Node/API, DoS)
File: net/sync.go
The inbound sync stream handler (net/sync.go:401-408) is only gated by inboundRL.allow(s.Conn().RemotePeer()) — a per-peer cooldown (syncRateLimiter, net/sync.go:62-77). There is no concurrency cap on inbound streams: syncRounds.slots (maxConcurrentSyncRounds=4, net/sync.go:34,88) only limits outbound resync rounds, not inbound handlers. libp2p runs the handler per stream.
An attacker trivially generates unlimited ed25519 keypairs, so unlimited distinct peer IDs, each bypassing the per-peer cooldown. Each accepted stream runs handleSyncStream (net/sync.go:540) which:
- calls frontiersWhereServerIsBehind (net/sync.go:608) over up to maxFrontiers=50000 remote frontiers (net/sync.go:44), and
- for each frontier calls ledger.GetBlockHeight (net/sync.go:618 / core/ledger.go:3378) — chainHashes fetches the full account chain and then linearly scans hashes for the target.
Cost per request is O(frontiers x chain length). Flooding sync streams from many peer IDs keeps node CPU saturated at ~100% and can stall block processing. Because the limiter map cleanup loop (net/sync.go:67-71) also holds the limiter mutex while iterating every tracked peer, the flood additionally serializes on this mutex.
Suggested fix: add a global inbound sync concurrency cap (semaphore) plus a global token-bucket rate limit independent of peer identity, and bound work per handler (e.g. early-exit after N expensive GetBlockHeight calls, or memoize chain hashes).
Thread
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-16484 and says what differs; it is read like any other.