# GHSA-qvqg-6rp8-4p9h: github.com/ipfs/kubo affected by DOS Bitswap unbounded persistent memory leak

> An attacker can cause a denial of service in IPFS Kubo nodes by sending excessive Bitswap requests that exhaust memory.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 May 2023

## What is GHSA-qvqg-6rp8-4p9h?

GHSA-qvqg-6rp8-4p9h is a denial of service vulnerability in github.com/ipfs/kubo, published on 11 May 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official 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 or connecting untrusted connections such as by running in the public swarm and no pnet config.
Nodes that are not publicly reachable but connects to untrusted nodes are also vulnerable to the untrusted nodes being connected to since libp2p connections are blindly bidirectional.

### Patches
- 19feb15833c6f4d6e7f1e1b132efaae96d76481d [`boxo`](https://github.com/ipfs/boxo) update in Kubo
- GHSA-m974-xj4j-7qv5 patches in boxo

### Workarounds

Use [PNET](https://github.com/ipfs/kubo/blob/master/docs/experimental-features.md#private-networks), [swarm filters](https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmaddrfilters) or [resource manager allows list](https://pkg.go.dev/github.com/libp2p/go-libp2p/p2p/host/resource-manager#readme-allowlisting-multiaddrs-to-mitigate-eclipse-attacks) to block untrusted connections.

Note that using the resource manager will disrupt both client and server features because the bitswap protocol is a message based protocol mixing requests and responses.

### References
- GHSA-m974-xj4j-7qv5
- [CVE-2023-25568](https://nvd.nist.gov/vuln/detail/CVE-2023-25568)

## Which versions are affected by GHSA-qvqg-6rp8-4p9h?

2 open source packages ship an affected version, including github.com/ipfs/kubo.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/ipfs/kubo` | Go | All versions | 0.19.0 |
| `github.com/ipfs/kubo` | Go | All versions | 0.19.0 |

## How do I fix GHSA-qvqg-6rp8-4p9h?

Upgrade github.com/ipfs/kubo to 0.19.0 or later.

## Is GHSA-qvqg-6rp8-4p9h being exploited?

There is no known exploitation of GHSA-qvqg-6rp8-4p9h in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-qvqg-6rp8-4p9h and fix it if it is affected.

What it is: GHSA-qvqg-6rp8-4p9h is a denial of service vulnerability in github.com/ipfs/kubo, published on 11 May 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-qvqg-6rp8-4p9h in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/ipfs/kubo (Go): affected all versions; fixed in 0.19.0
- github.com/ipfs/kubo (Go): affected all versions; fixed in 0.19.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-qvqg-6rp8-4p9h/ (Markdown: https://insights.sbomify.com/GHSA-qvqg-6rp8-4p9h/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-qvqg-6rp8-4p9h

---
From sbomify Insights: https://insights.sbomify.com/GHSA-qvqg-6rp8-4p9h/
Summaries are generated and may contain mistakes; the official description above is the record.
