github.com/ipfs/go-libipfs
Affected
- introduced
0.5.0, fixed0.6.0(semver)
Fixed versions
0.6.0
Fix
- Fixed version
0.6.0go get github.com/ipfs/[email protected]
Advisory
Also known as: CVE-2023-25568, GHSA-q3j6-22wf-3jh9, GO-2023-1766
Boxo bitswap/server: DOS unbounded persistent memory leak
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:
boxo to `v0.6.0` or laterboxo to `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
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.PeerDisconnected callback is received.MaxCidSize option and defaults to 168 bytes.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).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).PeerConnectedPatches
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`.
High Basis: The source's own band: HIGH
0.5.0, fixed 0.6.0 (semver)0.6.0
0.6.0go get github.com/ipfs/[email protected]0, fixed 0.4.1 (semver)0.4.1
0.4.1go get github.com/ipfs/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0