GHSA-X2VM-CF3P-M2W8

Vulnerability from github – Published: 2026-11-17 21:06 – Updated: 2026-11-17 21:06
VLAI
Summary
libp2p: gossipsub creates a permanent topics-map entry per distinct subscription with no cap in the default config
Details

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

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "@libp2p/gossipsub"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "17.0.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-119793"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-400",
      "CWE-770"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-17T21:06:20Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "### Summary\nA single gossipsub peer can grow a node\u0027s `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.\n\n### Details\n`handleReceivedSubscription` (`packages/gossipsub/src/gossipsub.ts:1028`, line 1036) runs `this.topics.set(topic, new Set())` for every distinct topic string:\n\n```ts\nprivate handleReceivedSubscription (from, topic, subscribe) {\n  let topicSet = this.topics.get(topic)\n  if (subscribe) {\n    if (topicSet == null) {\n      topicSet = new Set()\n      this.topics.set(topic, topicSet)   // no global cap, no per-peer cap\n    }\n    topicSet.add(from.toString())\n  }\n}\n```\n\nThe only topical gate (`gossipsub.ts:981`, `if (this.allowedTopics != null \u0026\u0026 !this.allowedTopics.has(topic)) return`) is skipped when `allowedTopics` is null \u2014 the default. Subscriptions are unsigned RPC metadata (no signature needed); `decodeRpc`\u0027s per-RPC limit caps count (`maxSubscriptions = 5000`) but not topic-string length or aggregate size; and the peer-scoring components P1\u2013P7 have no subscription-volume term, so the attacker\u0027s score stays at 0 (above the `graylistThreshold` of \u221280) and `acceptFrom` keeps returning true. Verified on js-libp2p commit `a04f5e0`, where `@libp2p/gossipsub` reads `16.0.4`.\n\n### PoC\nFull PoC attached (`gossipsub-topics-unbounded-growth-poc.tar.gz`). Build the js-libp2p monorepo at the affected version (`npm install --ignore-scripts \u0026\u0026 npm run build`), extract the package inside the monorepo root (sibling of `packages/`), then `cd gossipsub-topics-unbounded-growth-poc \u0026\u0026 node attack.mjs`. Expected (default config):\n\n```\n[*] sending 300 RPC frames x 4000 unique ~190-byte topic subscriptions (1,200,000 topics total)\n[*]   progress: 88% sent | victim topics=1,032,000 rss=740MB peers=1\n[*] victim quiesced: topics=~1,100,000 rss=~870MB peers=1\n[!] Vulnerability reproduced: one connected peer grew the victim\u0027s gossipsub topics map to ~1.1M entries (RSS +~900MB) with 300 subscription RPCs \u2014 no global, per-peer, or topic-length cap in the default config\n```\n\nControl 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 \u2014 confirming the vulnerable condition is the default `allowedTopics`-unset config. The map grows monotonically with no cap until the victim\u0027s 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.\n\n### Impact\nCWE-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) \u2014 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`\u0027s topic iteration non-blocking/capped.\n\n[gossipsub-topics-unbounded-growth-poc.tar.gz](https://github.com/user-attachments/files/30452451/gossipsub-topics-unbounded-growth-poc.tar.gz)",
  "id": "GHSA-x2vm-cf3p-m2w8",
  "modified": "2026-11-17T21:06:20Z",
  "published": "2026-11-17T21:06:20Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/libp2p/js-libp2p/security/advisories/GHSA-x2vm-cf3p-m2w8"
    },
    {
      "type": "WEB",
      "url": "https://github.com/libp2p/js-libp2p/pull/3593"
    },
    {
      "type": "WEB",
      "url": "https://github.com/libp2p/js-libp2p/commit/d5534174d8b7d23ac1bd45a7e738664fbfb0cf4c"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/libp2p/js-libp2p"
    },
    {
      "type": "WEB",
      "url": "https://github.com/libp2p/js-libp2p/releases/tag/gossipsub-v17.0.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "libp2p: gossipsub creates a permanent topics-map entry per distinct subscription with no cap in the default config"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…