Inbound connection cap has no subnet aggregate: 32 IPv4 addresses (or 8 IPv6 /48s) fill the 256-connection cap despite the per-IP limit
Report
[Medium] Inbound connection cap has no subnet aggregate: 32 IPv4 addresses (or 8 IPv6 /48s) fill the 256-connection cap despite the per-IP limit
- Suggested tier: Medium (one-directional isolation of a node: it refuses every new inbound peer indefinitely; outbound dialing still works, so this is not a full eclipse — the same impact calibration as XE-1738, claimed Medium)
- Area: P2P/sync —
net/netcheck.go,net/host.go,cmd/xe/main.go - Head / commit under test: xe
8cc209d65c16089158da8fabd392628b71fe0711(testnet-0006 build, public repo HEAD) - Found: 2026-11-17, read-only local source review. No live testing, no account use, no connections opened against the public testnet.
- Payout address (XE):
db4043dea0d12c476c2644a3df09c4ce51fa1ce04617723405916ade3fa3305f
Summary
A node's inbound connection ceiling is a single global counter with no subnet aggregate below it. The per-IP limit added since XE-1738 only bounds one address: IPv4 /32 = 8 connections (net/host.go:90-98), so 32 distinct IPv4 addresses × 8 connections = 256 exactly fills the default cap (defaultMaxInboundConns = 256, net/netcheck.go:39). IPv6 is cheaper still: /56 = 8 and /48 = 32, so 8 × /48 = 256. Every connection is fully legitimate under every limit in the stack — the cap check itself is never bypassed, it is saturated. Once filled, the node refuses every new inbound peer indefinitely, because nothing ever closes the holding connections: there is no idle timeout, the connection manager only trims above 400 total connections, and the netcheck ban only fires on handshake failure. Completing the netcheck handshake needs only public parameters (network id, genesis hash, version), which the victim discloses pre-check.
Vulnerable code at HEAD
net/netcheck.go:306-320(InterceptSecured): refuses a new inbound peer only when the single globalg.inboundcounter reachesmax(default 256). The only exemption isg.isTrusted(p)— membership in an operator-configured peer-ID set (Trust(),netcheck.go:150-159); completing the netcheck handshake does not make a peer trusted.net/netcheck.go:335-350(ConnectedF/DisconnectedF): the counter moves only on connect/disconnect. Nothing else ever decrements it, and no liveness check ever closes a live connection: everyClosePeercall site in the repo (net/netcheck.go:406,412,424,435,454,462,468) fires only on a handshake/verification failure.net/host.go:34: connection manager low/high water 100/400 with a 1-minute grace period — trimming fires only above 400 total connections, so 256 inbound + ordinary outbound (~6–60) never triggers it. The rcmgr has no idle-connection timeout; pubsub/DHT never prune connections.net/host.go:90-98(newResourceManager): the only per-source bound is the subnet limiter — IPv4{PrefixLength: 32, ConnCount: 8}, IPv6{56, 8}and{48, 32}. There is no /24 (or any broader v4) aggregate and no aggregate broader than /48 for v6.cmd/xe/main.go:1314-1315:--max-conns-per-ipdefaults to 8 and--max-inbound-connsdefaults to 0 → 256, so the arithmetic above holds on a default node.net/netcheck.go:391-410(handleNetcheckInbound): the victim answers with its own network id, version, features and genesis hash before checking the peer, so the attacker needs no prior knowledge to complete the handshake. The handshake rate limiters do not block this either: the global netcheck bucket is 32 RPS / burst 128 (netcheck.go:42-46), the per-peer limiter is per peer ID (each connection is a distinct peer ID), and the subnet connection rate limiter allows burst 16 per /32 (net/host.go:110-117) — 8 connections per IP fit inside it.
Worst case
An attacker with 32 IPv4 addresses (a /27 — a few dollars a month from any VPS provider) or 8 IPv6 /48s opens 8 libp2p connections from each, completes the netcheck handshake with the victim's own public parameters, and holds them. The victim's inbound counter sits at 256 and every further inbound connection is refused (inboundRefused counter only — silent from the outside). Other nodes cannot dial it, new nodes cannot join through it, and nodes that lose their existing connection cannot reconnect. The attacker's connections are indistinguishable from legitimate peers under every configured limit, so no existing alert fires. Outbound dialing still works, so the node can still reach others — one-directional isolation, not a full blackout. Rotating the same attack across the bootstrap nodes degrades peer discovery for everyone joining the network.
Reproduction (code-trace verified; NOT executed live)
- From each of 32 IPv4 addresses, open 8 libp2p connections to the target and complete the netcheck handshake with the target's public network id / genesis hash / version.
- Hold the connections (no traffic needed — there is no idle timeout and 256 total stays below the connmgr 400 high-water mark).
- A 257th inbound connection from an unrelated host is refused by
InterceptSecured.
Verification limits, stated honestly: this finding is verified by direct code trace at the pinned HEAD (every function above read in full, including the libp2p v0.47.0 resource-manager and connmgr sources the limits depend on). The 256-connection variant was deliberately not run against the public testnet — proving it live would take a live node off the network during someone else's testing, which is load work this programme's rules do not permit without a prior heads-up filing. The arithmetic (32 × 8 = 256) and the absence of any closer/timeout/aggregate are unambiguous in the source.
De-duplication
- XE-1738 is the single-host instance, closed invalid. Its title and body are "256 connections from one host" with "no per-IP limit". The team closed it because "the host is built with a per-address connection limit and a per-address connection rate limit, so a single host cannot occupy the inbound budget as described." This report respects that limit — every address stays within its 8-connection budget — and reports the residual half of XE-1738's own suggested fix #1 ("Per-IP (or per-/24) sub-limit"): the per-IP half was implemented, the per-/24 aggregate half was not. The team's reply also says "the broader question of many cheap identities pressing on inbound admission is already covered by earlier reports" without naming one; a full title search of the 2,845-ticket corpus finds no earlier report with this mechanism (see below).
- XE-1298 / XE-15165 / XE-15594 / XE-14242 are the check-then-act race: the counter moves only after the gate, so a concurrent burst sails past the cap. This report fills the cap within the rules — no race, no burst, sequential filling works because holding connections is indefinite. XE-15165 (status new) is a dispute on the race only.
- XE-0020 / XE-0025 / XE-2352 (per-peer-ID keying bypass family): those are about limits keyed on a rotatable peer ID. Here both binding limits (per-IP 8, global 256) are respected as designed; the defect is the missing aggregate between them, with a different fix.
- XE-0125 (24 sybil inbound peers stop ambient discovery via
peerCount()), XE-16484 (inbound sync CPU DoS), XE-15049 (sync page OOM), XE-16868 (API rate limiter /64 vs /48), XE-16550 / XE-16867 (SSH gateway per-IP) are different mechanisms/endpoints. - No corpus title mentions a subnet aggregate, a /24 limit, or filling the inbound cap from multiple addresses within per-IP budgets.
Suggested fix
Add a subnet-aggregate sub-limit alongside the global cap (e.g. per-/24 for IPv4, per-/48 already exists for v6 but needs a broader aggregate above it), or exempt already-verified peers (netcheck passed, known vote weight) from the ceiling so a node under this pressure still accepts the peers that matter, or close connections from peers that complete netcheck but never participate (gossip/sync) after an idle timeout.
Thread
Nothing public yet.