Boxo bitswap/server: DOS unbounded persistent memory leakGHSA-m974-xj4j-7qv5
HIGHFix: ipfs/boxo@62cbac4GHSA-m974-xj4j-7qv5 is a high-severity (CVSS 8.2) Uncontrolled Resource Consumption vulnerability in github.com/ipfs/go-libipfs. A fix is available for github.com/ipfs/go-libipfs — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-m974-xj4j-7qv5.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
github.com/ipfs/go-libipfs🐹github.com/ipfs/go-libipfsReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Impact
An attacker is able allocate arbitrarily many bytes in the Bitswap server by sending many WANT_BLOCK and or WANT_HAVE requests which are queued in an unbounded queue, with allocations that persist even if the connection is closed.
This affects users accepting untrusted connections with the Bitswap server, this also affects users using the old API stubs at github.com/ipfs/boxo/bitswap because it transitively uses github.com/ipfs/boxo/bitswap/server.
We have renamed go-libipfs to boxo; this document uses both terms interchangeably. The version numbers for both are applicable, as they share the same historical timeline.
Remediation
Apply one of:
- Update
boxotov0.6.0or later - Update
boxotov0.4.1Note thatv0.5.0is NOT safe,v0.4.1is a backport of thev0.6.0security fixes on top ofv0.4.0.
Mitigations
- The server now limits how many wantlist entries per peer it knows.
The
MaxQueuedWantlistEntriesPerPeeroption allows configuring how many wantlist entries the server remembers; if a peer sends a wantlist bigger than this (including a sum of multiple delta updates) the server will truncate the wantlist to the match the limit. This defaults to1024entries per peer. - The server now properly clears state about peers when they disconnect.
Peer state is more lazily allocated (only when a wantlist is received in the first place) and is properly cleared when the
PeerDisconnectedcallback is received. - The server now ignores CIDs above some size.
Clients were able to send any CID as long as the total protobuf message were bellow the 4MiB limit. This is allowed to allocate lots of memory with very little entries.
This can be configured using the
MaxCidSizeoption and defaults to168 bytes. - The server now closes the connection if an inline CID is requested (either as
WANT_*orCANCEL). The attack were more effective if done with CIDs that are present in target's blockstore, this is because this will push longer-lasting jobs on some priority queue. Since inline CID are literal data (instead of hashes of data), everyone always "has" any inline CID (since instead of loading the data from disk, it can be extracted from the CID). It makes no sense for anyone to ever ask you about an inline CID since they could also just parse it themselves. Thus, as a defensive measure, we kill the connection with peers that ask about an inline CID.
Vulnerable symbols
github.com/ipfs/go-libipfs/bitswap/server/internal/decision.(*Engine).MessageReceivedgithub.com/ipfs/go-libipfs/bitswap/server/internal/decision.(*Engine).NotifyNewBlocksgithub.com/ipfs/go-libipfs/bitswap/server/internal/decision.(*Engine).findOrCreategithub.com/ipfs/go-libipfs/bitswap/server/internal/decision.(*Engine).PeerConnected
Patches
- https://github.com/ipfs/boxo/commit/9cb5cb54d40b57084d1221ba83b9e6bb3fcc3197 (mitigations 1 and 2)
- https://github.com/ipfs/boxo/commit/62cbac40b96f49e39cd7fedc77ee6b56adce4916 (mitigations 3 and 4)
- https://github.com/ipfs/boxo/commit/baa748b682fabb21a4c1f7628a8af348d4645974 (tests)
Workarounds
If you are using the stubs at github.com/ipfs/go-libipfs/bitswap and not taking advantage of the features provided by the server, refactoring your code to use the new split API will allow you to run in a client-only mode using: github.com/ipfs/boxo/bitswap/client.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/ipfs/go-libipfs | ≥ 0.5.0&&< 0.6.0 | 0.6.0go get github.com/ipfs/go-libipfs@v0.6.0 |
| 🐹Go | github.com/ipfs/go-libipfs | all versions | 0.4.1go get github.com/ipfs/go-libipfs@v0.4.1 |
Affected Products
boxoprotocolDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/ipfs/go-libipfs, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update github.com/ipfs/go-libipfs to 0.6.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-m974-xj4j-7qv5 is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Frequently Asked Questions
Is GHSA-m974-xj4j-7qv5 in your dependencies?
Find it across Go, including transitive dependencies.