Boxo, formerly known as go-libipfs, is a library for building IPFS applications and implementations. In versions 0.4.0 and 0.5.0, if an attacker is able allocate arbitrary many bytes in the Bitswap server, those allocations are lasting even if the connection is closed. This affects users accepting untrusted connections with the Bitswap server and also affects users using the old API stubs at `github.com/ipfs/go-libipfs/bitswap` because users then transitively import `github.com/ipfs/go-libipfs/bitswap/server`. Boxo versions 0.6.0 and 0.4.1 contain a patch for this issue. As a workaround, those who are using the stub object at `github.com/ipfs/go-libipfs/bitswap` not taking advantage of the features provided by the server can refactor their code to use the new split API that will allow them to run in a client only mode: `github.com/ipfs/go-libipfs/bitswap/client`.
Boxo, formerly known as go-libipfs, is a library for building IPFS applications and implementations. In versions 0.4.0 and 0.5.0, if an attacker is able allocate arbitrary many bytes in the Bitswap server, those allocations are lasting even if the connection is closed. This affects users accepting untrusted connections with the Bitswap server and also affects users using the old API stubs at `github.com/ipfs/go-libipfs/bitswap` because users then transitively import `github.com/ipfs/go-libipfs/bitswap/server`. Boxo versions 0.6.0 and 0.4.1 contain a patch for this issue. As a workaround, those who are using the stub object at `github.com/ipfs/go-libipfs/bitswap` not taking advantage of the features provided by the server can refactor their code to use the new split API that will allow them to run in a client only mode: `github.com/ipfs/go-libipfs/bitswap/client`.
Boxo, formerly known as go-libipfs, is a library for building IPFS applications and implementations. In versions 0.4.0 and 0.5.0, if an attacker is able allocate arbitrary many bytes in the Bitswap server, those allocations are lasting even if the connection is closed. This affects users accepting untrusted connections with the Bitswap server and also affects users using the old API stubs at `github.com/ipfs/go-libipfs/bitswap` because users then transitively import `github.com/ipfs/go-libipfs/bitswap/server`. Boxo versions 0.6.0 and 0.4.1 contain a patch for this issue. As a workaround, those who are using the stub object at `github.com/ipfs/go-libipfs/bitswap` not taking advantage of the features provided by the server can refactor their code to use the new split API that will allow them to run in a client only mode: `github.com/ipfs/go-libipfs/bitswap/client`.
### 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](https://github.com/ipfs/boxo/issues/215); 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 `boxo` to [`v0.6.0`](https://github.com/ipfs/boxo/releases/tag/v0.6.0) or later
- Update `boxo` to [`v0.4.1`](https://github.com/ipfs/boxo/releases/tag/v0.4.1)
Note that ***`v0.5.0` is NOT safe***, `v0.4.1` is a backport of the `v0.6.0` security fixes on top of `v0.4.0`.
### Mitigations
1. The server now limits how many wantlist entries per peer it knows.
The `MaxQueuedWantlistEntriesPerPeer` option 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 to `1024` entries per peer.
2. 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 `PeerDisconnected` callback is received.
3. 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 `MaxCidSize` option and defaults to `168 bytes`.
4. The server now closes the connection if an inline CID is requested (either as `WANT_*` or `CANCEL`).
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).MessageReceived`
- `github.com/ipfs/go-libipfs/bitswap/server/internal/decision.(*Engine).NotifyNewBlocks`
- `github.com/ipfs/go-libipfs/bitswap/server/internal/decision.(*Engine).findOrCreate`
- `github.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`](https://pkg.go.dev/github.com/ipfs/boxo/bitswap/client).
This package has been moved to [`github.com/ipfs/boxo/bitswap`](https://pkg.go.dev/github.com/ipfs/boxo/bitswap), this vulnerability is tracked there: https://github.com/ipfs/boxo/security/advisories/GHSA-m974-xj4j-7qv5 (`CVE-2023-25568`)
### Remediation
This is a two step process:
1. Apply one of:
- (**recommended**) upgrade from `github.com/ipfs/go-bitswap` to `github.com/ipfs/boxo/bitswap`.
- If you are still using `github.com/ipfs/go-bitswap` and cannot upgrade to `boxo`, you can upgrade to `github.com/ipfs/[email protected]`, this will replace the `go-bitswap` implementation by stubs which points to `boxo`.
2. Open https://github.com/ipfs/boxo/security/advisories/GHSA-m974-xj4j-7qv5 and then follow `boxo`'s remediation section.
### Vulnerable symbols
- `>= v0.9.0; < v0.12.0`
- `github.com/ipfs/go-bitswap/server/internal/decision.(*Engine).MessageReceived`
- `github.com/ipfs/go-bitswap/server/internal/decision.(*Engine).NotifyNewBlocks`
- `github.com/ipfs/go-bitswap/server/internal/decision.(*Engine).findOrCreate`
- `github.com/ipfs/go-bitswap/server/internal/decision.(*Engine).PeerConnected`
- `v0.8.0`
- `github.com/ipfs/go-bitswap/internal/decision.(*Engine).MessageReceived`
- `github.com/ipfs/go-bitswap/internal/decision.(*Engine).NotifyNewBlocks`
- `github.com/ipfs/go-bitswap/internal/decision.(*Engine).findOrCreate`
- `github.com/ipfs/go-bitswap/internal/decision.(*Engine).PeerConnected`
- `< v0.8.0`
- `github.com/ipfs/go-bitswap/internal/decision.(*Engine).MessageReceived`
- `github.com/ipfs/go-bitswap/internal/decision.(*Engine).receiveBlocksFrom`
- `github.com/ipfs/go-bitswap/internal/decision.(*Engine).findOrCreate`
- `github.com/ipfs/go-bitswap/internal/decision.(*Engine).PeerConnected`
### Workarounds
If you are using the stubs at `github.com/ipfs/go-bitswap` and not taking advantage of the features provided by the server, refactoring your code to use the new split API will allows you to run in a client-only mode using: [`github.com/ipfs/go-bitswap/client`](https://pkg.go.dev/github.com/ipfs/go-bitswap/client).
EUVD source date text has no stated timezone and is retained without inventing a UTC instant. Related bulletin membership is not an alias, common cause or applicability claim. A missing vector with a zero score is treated as unrated. Complete vendor/product and underlying source evidence remains in the original JSON.
Original publisher date fields
datePublished: May 10, 2023, 12:00:00 AM
dateUpdated: Feb 13, 2025, 4:44:30 PM
No normalized affected-package data is projected for this source revision. The original publisher record may contain additional product and version evidence; this does not establish that a package is unaffected.
NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON.
Source analysis status: Modified
Weakness classifications: CWE-400 · CWE-770
Original publisher date fields
published: 2023-05-10T14:15:32.187
lastModified: 2026-06-17T05:41:30.613
2 source CPE criteria · context only
cpe:2.3:a:protocol:boxo:0.4.0:*:*:*:*:go:*:*
cpe:2.3:a:protocol:boxo:0.5.0:*:*:*:*:go:*:*
The original JSON retains the logical configuration operators, exclusions and version bounds.
No normalized affected-package data is projected for this source revision. The original publisher record may contain additional product and version evidence; this does not establish that a package is unaffected.