# CVE-2021-41084: Response Splitting from unsanitized headers in http4s

> Attackers can perform response splitting by injecting unsanitized user input into HTTP headers or status fields in http4s applications.

- **Severity:** High 8.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/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:** 21 Sep 2021
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-5vcm-3xc3-w7x3

## What is CVE-2021-41084?

CVE-2021-41084 is a high-severity vulnerability in http4s, published on 21 Sep 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

http4s is an open source scala interface for HTTP. In affected versions http4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields: Header names (`Header.name`å), Header values (`Header.value`), Status reason phrases (`Status.reason`), URI paths (`Uri.Path`), URI authority registered names (`URI.RegName`) (through 0.21). This issue has been resolved in versions 0.21.30, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following. As a matter of practice http4s services and client applications should sanitize any user input in the aforementioned fields before returning a request or response to the backend. The carriage return, newline, and null characters are the most threatening.

Weakness: CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component), CWE-918 (Server-Side Request Forgery)

## Which versions are affected by CVE-2021-41084?

40 open source packages ship an affected version, including org.http4s:http4s-client_2.12, org.http4s:http4s-client_2.13 and org.http4s:http4s-client_3. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.http4s:http4s-client_2.12` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-client_2.12` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-client_2.12` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-client_2.12` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-client_2.12` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-client_2.12` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-client_2.13` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-client_2.13` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-client_2.13` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-client_2.13` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-client_2.13` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-client_2.13` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-client_3` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-client_3` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-client_3` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-client_3` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-client_3` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-client_3` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-server_2.10` | Maven | All versions to 0.21.28 | None |
| `org.http4s:http4s-server_2.10` | Maven | All versions to 0.21.28 | None |
| `org.http4s:http4s-server_2.11` | Maven | All versions to 0.21.28 | None |
| `org.http4s:http4s-server_2.11` | Maven | All versions to 0.21.28 | None |
| `org.http4s:http4s-server_2.12` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-server_2.12` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-server_2.12` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-server_2.12` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-server_2.12` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-server_2.12` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-server_2.13` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-server_2.13` | Maven | All versions | 0.21.29 |
| `org.http4s:http4s-server_2.13` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-server_2.13` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-server_2.13` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-server_2.13` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-server_2.13.0-M5` | Maven | All versions to 0.21.28 | None |
| `org.http4s:http4s-server_2.13.0-M5` | Maven | All versions to 0.21.28 | None |
| `org.http4s:http4s-server_3` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-server_3` | Maven | From 0.22.0 | 0.22.5 |
| `org.http4s:http4s-server_3` | Maven | From 0.23.0 | 0.23.4 |
| `org.http4s:http4s-server_3` | Maven | From 0.23.0 | 0.23.4 |

Products: Typelevel Http4s.

## How do I fix CVE-2021-41084?

Upgrade org.http4s:http4s-client_2.12 to a fixed version for your release line: 0.21.29, 0.22.5 or 0.23.4.

## Is CVE-2021-41084 being exploited?

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

## Other vulnerabilities in http4s

- [CVE-2021-39185](https://insights.sbomify.com/CVE-2021-39185/): Default CORS config allows any origin with credentials (critical 9.1)
- [CVE-2020-5280](https://insights.sbomify.com/CVE-2020-5280/): Local file inclusion vulnerability in http4s (high 7.6)
- [CVE-2023-22465](https://insights.sbomify.com/CVE-2023-22465/): Http4s has fatal error parsing User-Agent and Server headers (high 7.5)
- [CVE-2021-21294](https://insights.sbomify.com/CVE-2021-21294/): Unbounded connection acceptance in http4s-blaze-server (high 7.5)
- [CVE-2025-59822](https://insights.sbomify.com/CVE-2025-59822/): Http4s vulnerable to HTTP Request Smuggling due to improper handling of HTTP trailer section (medium 6.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-41084 and fix it if it is affected.

What it is: CVE-2021-41084 is a high-severity vulnerability in http4s, published on 21 Sep 2021. 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-2021-41084 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.http4s:http4s-client_2.12 (Maven): affected all versions; fixed in 0.21.29
- org.http4s:http4s-client_2.12 (Maven): affected all versions; fixed in 0.21.29
- org.http4s:http4s-client_2.12 (Maven): affected from 0.22.0; fixed in 0.22.5
- org.http4s:http4s-client_2.12 (Maven): affected from 0.22.0; fixed in 0.22.5
- org.http4s:http4s-client_2.12 (Maven): affected from 0.23.0; fixed in 0.23.4
- org.http4s:http4s-client_2.12 (Maven): affected from 0.23.0; fixed in 0.23.4
- org.http4s:http4s-client_2.13 (Maven): affected all versions; fixed in 0.21.29
- org.http4s:http4s-client_2.13 (Maven): affected all versions; fixed in 0.21.29
- org.http4s:http4s-client_2.13 (Maven): affected from 0.22.0; fixed in 0.22.5
- org.http4s:http4s-client_2.13 (Maven): affected from 0.22.0; fixed in 0.22.5
- org.http4s:http4s-client_2.13 (Maven): affected from 0.23.0; fixed in 0.23.4
- org.http4s:http4s-client_2.13 (Maven): affected from 0.23.0; fixed in 0.23.4

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

## Sources

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

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