{"id":"XE-16868","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"678","source_url":"https://github.com/xeprotocol/xe/issues/678","reporter_id":2920,"title":"[Low] API rate limiter groups IPv6 by /64 only — one /48 buys 65,536 independent buckets","area":"node-api","claimed_tier":"minor","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":true,"internal_ref":"","internal_url":null,"status":"triaging","closed_reason":null,"github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T06:51:55.856708+00:00","updated_at":"2026-11-22T23:26:19.117595+00:00","source_created_at":"2026-11-17T06:50:26+00:00","told_at":"2026-11-22T23:26:19.123125+00:00","status_changed_at":"2026-11-22T23:26:05.197684+00:00","url":"https://bounty.xe.network/XE-16868","body":"## Summary\n\n`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.\n\n## Root Cause\n\n`clientKey` (`api/handler.go:416-429`):\n\n```go\np, _ := a.WithZone(\"\").Prefix(64)\nreturn p.String()\n```\n\nOnly the /64 prefix is kept. Contrast `newResourceManager` (`net/host.go:90-99`), which applies per-subnet connection limits at /56 *and* /48 for IPv6.\n\n## Impact\n\nThe 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.\n\nSeverity 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.\n\n## Verification\n\nExecuted in-package test against the real `clientKey` function:\n\n```\nclientKey(2001:db8::1)=2001:db8::/64 clientKey(2001:db8::2)=2001:db8::/64 clientKey(2001:db8::ffff)=2001:db8::/64\nclientKey(2001:db8:1::1)=2001:db8:1::/64 clientKey(2001:db8:2::1)=2001:db8:2::/64 (different buckets)\n```\n\nAdjacent /64s within the same /48 land in different buckets, confirming the 65,536-bucket multiplier for a /48 holder.\n\n## Note on related reports\n\nSearched \"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).\n\n## Suggested fix\n\nAdd /48 (and/or /56) grouping to `clientKey`, mirroring `net/host.go`.","patch_refs":[],"thread":[{"id":18919,"source":"desk","source_ref":"reply:16596","author":"Joseph Denne","team":true,"body":"Thanks for the report. How widely one network prefix shares a limit is a design choice, and it is being looked at.","created_at":"2026-11-22T23:26:19.117595+00:00"}]}