CVE-2026-119793: libp2p: gossipsub creates a permanent topics-map entry per distinct subscription with no cap in the default config

Published Nov 17, 2026
·
Updated

Summary A single gossipsub peer can grow a node's topics map without bound by flooding subscription RPCs, because the default configuration has no global, per-peer, or topic-length cap and peer scoring does not penalise subscription volume. The peer is never greylisted, so the growth continues toward OOM.

Details handleReceivedSubscription (packages/gossipsub/src/gossipsub.ts:1028, line 1036) runs this.topics.set(topic, new Set()) for every distinct topic string:

ts private handleReceivedSubscription (from, topic, subscribe) { let topicSet = this.topics.get(topic) if (subscribe) { if (topicSet == null) { topicSet = new Set() this.topics.set(topic, topicSet) // no global cap, no per-peer cap } topicSet.add(from.toString()) } }

The only topical gate (gossipsub.ts:981, if (this.allowedTopics != null && !this.allowedTopics.has(topic)) return) is skipped when allowedTopics is null — the default. Subscriptions are unsigned RPC metadata (no signature needed); decodeRpc's per-RPC limit caps count (maxSubscriptions = 5000) but not topic-string length or aggregate size; and the peer-scoring components P1–P7 have no subscription-volume term, so the attacker's score stays at 0 (above the graylistThreshold of −80) and acceptFrom keeps returning true. Verified on js-libp2p commit a04f5e0, where @libp2p/gossipsub reads 16.0.4.

PoC Full PoC attached (gossipsub-topics-unbounded-growth-poc.tar.gz). Build the js-libp2p monorepo at the affected version (npm install --ignore-scripts && npm run build), extract the package inside the monorepo root (sibling of packages/), then cd gossipsub-topics-unbounded-growth-poc && node attack.mjs. Expected (default config):

[] sending 300 RPC frames x 4000 unique ~190-byte topic subscriptions (1,200,000 topics total) [] progress: 88% sent | victim topics=1,032,000 rss=740MB peers=1 [] victim quiesced: topics=~1,100,000 rss=~870MB peers=1 [!] Vulnerability reproduced: one connected peer grew the victim's gossipsub topics map to ~1.1M entries (RSS +~900MB) with 300 subscription RPCs — no global, per-peer, or topic-length cap in the default config

Control run (ALLOWEDTOPICS=legit-topic, i.e. node attack.mjs control): the identical flood is rejected at the allowedTopics gate and the topics map stays at 0 entries — confirming the vulnerable condition is the default allowedTopics-unset config. The map grows monotonically with no cap until the victim's own resource pressure trips; on disconnect removePeer performs an O(N) sweep over every topic entry (a secondary CPU cost) while the ~1 GB heap stays committed.

Impact CWE-400/CWE-770. Every node running default gossipsub is affected; the attacker needs only one connection and is never rate-limited or greylisted. Growth continues toward OOM; on disconnect the O(N) removePeer sweep adds CPU cost. Suggested fix: bound by default (not opt-in) — a global cap on topics.size, a per-peer subscription cap with a P7 behaviour penalty so acceptFrom eventually greylists, a topic-string length cap at decode time, and/or flipping allowedTopics to deny-by-default; make removePeer's topic iteration non-blocking/capped.

gossipsub-topics-unbounded-growth-poc.tar.gz

Other sources

libp2p is a JavaScript implementation of the libp2p networking stack. Prior to 17.0.0, the @libp2p/gossipsub default configuration allows a connected remote peer to submit unsigned subscription RPC metadata for arbitrarily many distinct topic strings. handleReceivedSubscription in packages/gossipsub/src/gossipsub.ts creates a persistent topics-map entry for each accepted topic, while allowedTopics is unset by default, decodeRpc maxSubscriptions limits only one RPC rather than aggregate topic bytes, and peer scoring has no subscription-volume penalty. A single peer can therefore grow the topics map and committed heap toward out-of-memory conditions, and disconnecting additionally causes removePeer to scan all accumulated topic entries. This issue is fixed in version 17.0.0.

— MITRE

Affected Software

2 affected componentsFixes available
npm/@libp2p/gossipsub<17.0.0
npm/@libp2p/gossipsub<17.0.0
17.0.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/@libp2p/gossipsub to a version that resolves this vulnerability.

    Fixed in 17.0.0
  2. Configuration

    Configure allowedTopics with an explicit allowlist so subscriptions to topics not on the list are rejected.

    @libp2p/gossipsub allowedTopics = explicit allowlist (deny-by-default)

Event History

Nov 17, 2026
CVE Published
via MITRE·07:10 PM
Data Sourced
via MITRE·07:10 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:17 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·09:06 PM
Data Sourced
via GitHub·09:06 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·09:06 PM
Affected Software

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203