# CVE-2023-38697: protocol-http1 HTTP Request/Response Smuggling vulnerability

> Attackers can exploit HTTP request smuggling in the protocol-http1 Ruby library to bypass firewalls and desync parsers.

- **Severity:** Medium 5.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 4 Aug 2023
- **Updated:** 4 Oct 2024
- **Also known as:** AZL-27830, DEBIAN-CVE-2023-38697, GHSA-6jwc-qr2q-7xwj, UBUNTU-CVE-2023-38697

## What is CVE-2023-38697?

CVE-2023-38697 is a medium-severity vulnerability in socketry protocol-http1, published on 4 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

protocol-http1 provides a low-level implementation of the HTTP/1 protocol. RFC 9112 Section 7.1 defined the format of chunk size, chunk data and chunk extension. The value of Content-Length header should be a string of 0-9 digits, the chunk size should be a string of hex digits and should split from chunk data using CRLF, and the chunk extension shouldn't contain any invisible character. However, Falcon has following behaviors while disobey the corresponding RFCs: accepting Content-Length header values that have `+` prefix, accepting Content-Length header values that written in hexadecimal with `0x` prefix, accepting `0x` and `+` prefixed chunk size, and accepting LF in chunk extension. This behavior can lead to desync when forwarding through multiple HTTP parsers, potentially results in HTTP request smuggling and firewall bypassing. This issue is fixed in `protocol-http1` v0.15.1. There are no known workarounds.

Weakness: CWE-444 (Inconsistent Interpretation of HTTP Requests)

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

2 open source packages ship an affected version, including protocol-http1. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `protocol-http1` | RubyGems | All versions | 0.15.1 |
| `protocol-http1` | RubyGems | All versions | 0.15.1 |

Products: Socketry Protocol-Http1.

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

Upgrade protocol-http1 to 0.15.1 or later.

## Is CVE-2023-38697 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2023-38697 is a medium-severity vulnerability in socketry protocol-http1, published on 4 Aug 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-38697 in the wild and no public exploit code.

Affected packages and fixed versions:
- protocol-http1 (RubyGems): affected all versions; fixed in 0.15.1
- protocol-http1 (RubyGems): affected all versions; fixed in 0.15.1

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

## Sources

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

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