<!-- XE-16868 · [Low] API rate limiter groups IPv6 by /64 only — one /48 buys 65,536 independent buckets · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16868>. The page is the record; this is the same page for reading.*

XE-16868 · Bounty

# \[Low\] API rate limiter groups IPv6 by /64 only — one /48 buys 65,536 independent buckets

Triaging
claimed Minor
[xe#678](https://github.com/xeprotocol/xe/issues/678)
filed 2026-11-17 06:50 UTC
by kecedanzz77-bit

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Minor

Area
:   Node / API

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770295](https://bounty.xe.network/log/770295) 2026-11-22 23:27 UTC reply.mirror\_failed
- [770224](https://bounty.xe.network/log/770224) 2026-11-22 23:26 UTC proposal.adopted
- [770223](https://bounty.xe.network/log/770223) 2026-11-22 23:26 UTC reply.sent
- [769503](https://bounty.xe.network/log/769503) 2026-11-22 23:26 UTC proposal.adopted
- [769502](https://bounty.xe.network/log/769502) 2026-11-22 23:26 UTC ticket.status new → triaging
- [769180](https://bounty.xe.network/log/769180) 2026-11-22 23:25 UTC proposal.adopted
- [769179](https://bounty.xe.network/log/769179) 2026-11-22 23:25 UTC ticket.award
- [768053](https://bounty.xe.network/log/768053) 2026-11-22 23:25 UTC proposal.adopted
- [768052](https://bounty.xe.network/log/768052) 2026-11-22 23:25 UTC ticket.facts area
- [768051](https://bounty.xe.network/log/768051) 2026-11-22 23:25 UTC proposal.adopted
- [768050](https://bounty.xe.network/log/768050) 2026-11-22 23:25 UTC ticket.facts
- [768049](https://bounty.xe.network/log/768049) 2026-11-22 23:25 UTC proposal.adopted

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

### 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

**Joseph Denne**team2026-11-22 23:26 UTCdesk

Thanks for the report. How widely one network prefix shares a limit is a design choice, and it is being looked at.
