llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · @libp2p/gossipsub

GHSA-X2VM-CF3P-M2W8

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

Parche disponible
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -95 d de la divulgación
Exposición2 dDesde la divulgación, 17 nov 2026, 4:06 p. m.
Detección2 hDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Parche 17.0.0
Monitoreo
Detectada +1
14 ago 26
17 nov 26
20 nov 26
14 ago 26
8 sept 26
2 oct 26
26 oct 26
20 nov 26
FechaFaseEventoDetalle
Remediación Parche 17.0.0 @libp2p/gossipsub · -95 d desde divulgación
Divulgación Publicada GHSA-X2VM-CF3P-M2W8 divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

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

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 (`ALLOWED_TOPICS=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 https://github.com/user-attachments/files/30452451/gossipsub-topics-unbounded-growth-poc.tar.gz

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida Última
@libp2p/gossipsub< 17.0.0
17.0.0
17.2.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npm@libp2p/gossipsub
Corregida 17.0.0 -95 d 17.2.1 no afectada
Versiones corregidas17.0.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Otrahttps://github.com/libp2p/js-libp2p/security/advisories/GHSA-x2vm-cf3p-m2w8
Otrahttps://github.com/libp2p/js-libp2p/pull/3593
Otrahttps://github.com/libp2p/js-libp2p/commit/d5534174d8b7d23ac1bd45a7e738664fbfb0cf4c
Otrahttps://github.com/libp2p/js-libp2p
Otrahttps://github.com/libp2p/js-libp2p/releases/tag/gossipsub-v17.0.0

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.