[Low] API rate limiter groups IPv6 by /64 only — one /48 buys 65,536 independent buckets
Report
Summary
clientKey groups IPv6 addresses by /64 prefix only, with no broader /56 or /48 grouping — unlike the codebase's own libp2p resource manager, which limits at /56 and /48. An attacker controlling a /48 (a single standard allocation — e.g. a free Hurricane Electric /48, or a cloud/ISP delegation) can spread requests across 65,536 /64s, multiplying every API limit by that factor.
Root Cause
clientKey (api/handler.go:416-429):
p, _ := a.WithZone("").Prefix(64)
return p.String()
Only the /64 prefix is kept. Contrast newResourceManager (net/host.go:90-99), which applies per-subnet connection limits at /56 and /48 for IPv6.
Impact
The multiplier applies to every API limit: read 200/s burst 1000, write 10/s burst 50, probe 20/s burst 100, and the per-client heavy-list concurrency cap (2, perClientLimit, api/handler.go:660-670). Most concretely, it multiplies the already-reported heavy-list DoS vectors (#648 full-table scans): 2 concurrent heavy lists per /64 × 65,536 /64s. It also multiplies block-submission throughput and general read load.
Severity Low: exploiting it needs a /48-sized allocation, and /64 grouping is an industry-standard choice — but the codebase's own libp2p layer holds itself to a stricter standard, and the multiplier on #648 is real.
Verification
Executed in-package test against the real clientKey function:
clientKey(2001:db8::1)=2001:db8::/64 clientKey(2001:db8::2)=2001:db8::/64 clientKey(2001:db8::ffff)=2001:db8::/64
clientKey(2001:db8:1::1)=2001:db8:1::/64 clientKey(2001:db8:2::1)=2001:db8:2::/64 (different buckets)
Adjacent /64s within the same /48 land in different buckets, confirming the 65,536-bucket multiplier for a /48 holder.
Note on related reports
Searched "rate limit IPv6 /64 subnet grouping API" and "clientKey IPv6 prefix rate limiter bypass" — no hits. #396 is a different mechanism (the 100k IP map cap failing closed to deny-all), not subnet grouping. Distinct from the SSH gateway report filed alongside this one (different code, different mechanism: coarse grouping vs no grouping at all).
Suggested fix
Add /48 (and/or /56) grouping to clientKey, mirroring net/host.go.
Thread
Thanks for the report. How widely one network prefix shares a limit is a design choice, and it is being looked at.