libp2p gossipsubに接続してきた相手が大量のトピックを登録でき、メモリを使い果たされる脆弱性
Summary
接続してきた遠隔の相手が、署名のない購読要求で大量のトピックを登録できる脆弱性です。登録が残り続けてメモリが枯渇し、サービス停止につながるおそれがあります。影響するのは17.0.0より前の@libp2p/gossipsubで、修正版は17.0.0です。17.0.0以上に更新してください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
接続してきた遠隔の相手が、署名のない購読要求で大量のトピックを登録できる脆弱性です。登録が残り続けてメモリが枯渇し、サービス停止につながるおそれがあります。影響するのは17.0.0より前の@libp2p/gossipsubで、修正版は17.0.0です。17.0.0以上に更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| libp2pjs-libp2p | — | Not listed |
| @libp2pgossipsub | — | Not listed |
| npm@libp2p/gossipsub |
< 17.0.0→ 17.0.0 |
17.0.0 |
Original description The description as published by the source.
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 j…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com