# CVE-2023-48230: Cap'n Proto WebSocket message can cause crash

> A remote attacker can cause a crash in Cap'n Proto's KJ HTTP library via a buffer underrun when WebSocket compression is enabled.

- **Severity:** Medium 5.9 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Nov 2023
- **Updated:** 2 Aug 2024
- **Also known as:** AZL-42681, DEBIAN-CVE-2023-48230, GHSA-r89h-f468-62w3

## What is CVE-2023-48230?

CVE-2023-48230 is a medium-severity memory corruption vulnerability in capnproto, published on 21 Nov 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Cap'n Proto is a data interchange format and capability-based RPC system. In versions 1.0 and 1.0.1, when using the KJ HTTP library with WebSocket compression enabled, a buffer underrun can be caused by a remote peer. The underrun always writes a constant value that is not attacker-controlled, likely resulting in a crash, enabling a remote denial-of-service attack. Most Cap'n Proto and KJ users are unlikely to have this functionality enabled and so unlikely to be affected. Maintainers suspect only the Cloudflare Workers Runtime is affected.

If KJ HTTP is used with WebSocket compression enabled, a malicious peer may be able to cause a buffer underrun on a heap-allocated buffer. KJ HTTP is an optional library bundled with Cap'n Proto, but is not directly used by Cap'n Proto. WebSocket compression is disabled by default. It must be enabled via a setting passed to the KJ HTTP library via `HttpClientSettings` or `HttpServerSettings`. The bytes written out-of-bounds are always a specific constant 4-byte string `{ 0x00, 0x00, 0xFF, 0xFF }`. Because this string is not controlled by the attacker, maintainers believe it is unlikely that remote code execution is possible. However, it cannot be ruled out. This functionality first appeared in Cap'n Proto 1.0. Previous versions are not affected.

This issue is fixed in Cap'n Proto 1.0.1.1.

Weakness: CWE-787 (Out-of-bounds Write), CWE-124 (Buffer Underwrite)

## Which versions are affected by CVE-2023-48230?

It affects 1 product.


Products: Capnproto Capnproto.

## How do I fix CVE-2023-48230?

Upgrade to a fixed version.

## Is CVE-2023-48230 being exploited?

There is no known exploitation of CVE-2023-48230 in the wild and no public exploit code.

## Other vulnerabilities in capnproto

- [CVE-2015-2311](https://insights.sbomify.com/CVE-2015-2311/): Integer overflow in n/a (critical 9.8)
- [CVE-2015-2310](https://insights.sbomify.com/CVE-2015-2310/): Integer overflow in n/a (critical 9.1)
- [CVE-2015-2312](https://insights.sbomify.com/CVE-2015-2312/): Denial of service in n/a (high 7.5)
- [CVE-2015-2313](https://insights.sbomify.com/CVE-2015-2313/): Denial of service in n/a (high 7.5)
- [CVE-2017-7892](https://insights.sbomify.com/CVE-2017-7892/): Integer overflow in n/a (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-48230 and fix it if it is affected.

What it is: CVE-2023-48230 is a medium-severity memory corruption vulnerability in capnproto, published on 21 Nov 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 CVE-2023-48230 in the wild and no public exploit code.

Affected product: capnproto. No package-level version data is available, so check the vendor advisory linked from the reference page.

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/CVE-2023-48230/ (Markdown: https://insights.sbomify.com/CVE-2023-48230/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-48230
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-48230
- OSV: https://osv.dev/vulnerability/CVE-2023-48230

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-48230/
Summaries are generated and may contain mistakes; the official description above is the record.
