# CVE-2021-39214: Lacking Protection against HTTP Request Smuggling in mitmproxy

> Attackers can smuggle HTTP requests through mitmproxy, bypassing custom access controls and input sanitization implemented in event hooks.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/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:** 16 Sep 2021
- **Updated:** 4 Aug 2024
- **Also known as:** DEBIAN-CVE-2021-39214, GHSA-22gh-3r9q-xf38, PYSEC-2021-328, UBUNTU-CVE-2021-39214, openSUSE-SU-2023:0232-1, openSUSE-SU-2023:0233-1

## What is CVE-2021-39214?

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

### Official description

mitmproxy is an interactive, SSL/TLS-capable intercepting proxy. In mitmproxy 7.0.2 and below, a malicious client or server is able to perform HTTP request smuggling attacks through mitmproxy. This means that a malicious client/server could smuggle a request/response through mitmproxy as part of another request/response's HTTP message body. While a smuggled request is still captured as part of another request's body, it does not appear in the request list and does not go through the usual mitmproxy event hooks, where users may have implemented custom access control checks or input sanitization. Unless one uses mitmproxy to protect an HTTP/1 service, no action is required. The vulnerability has been fixed in mitmproxy 7.0.3 and above.

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

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

3 open source packages ship an affected version, including mitmproxy. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mitmproxy` | PyPI | All versions | 7.0.3 |
| `mitmproxy` | PyPI | All versions | 7.0.3 |
| `mitmproxy` | PyPI | All versions | 7.0.3 |
| `python-mitmproxy` | SUSE:Package Hub 15 SP4 | All versions | 3.0.4-bp154.2.3.1 |
| `python-mitmproxy` | SUSE:Package Hub 15 SP5 | All versions | 3.0.4-bp155.3.3.1 |
| `python-mitmproxy` | openSUSE:Leap 15.4 | All versions | 3.0.4-bp154.2.3.1 |
| `python-mitmproxy` | openSUSE:Leap 15.5 | All versions | 3.0.4-bp155.3.3.1 |

Products: Mitmproxy Mitmproxy.

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

Upgrade mitmproxy to 7.0.3 or later.

## Is CVE-2021-39214 being exploited?

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

Public exploit code:

- secDevLabs Golden Hat Society: mitmproxy 5.3.0 request smuggling, CVE-2021-39214 (OWASP A06), run with Isoloom (github_poc): https://github.com/CyberCTF/secdevlabs-golden-hat

## Other vulnerabilities in mitmproxy

- [CVE-2022-24766](https://insights.sbomify.com/CVE-2022-24766/): Insufficient Protection against HTTP Request Smuggling in mitmproxy (critical 9.8)
- [CVE-2018-14505](https://insights.sbomify.com/CVE-2018-14505/): Mitmweb in mitmproxy allows DNS Rebinding attacks (high 8.8)
- [CVE-2026-40606](https://insights.sbomify.com/CVE-2026-40606/): ProxyAuth Addon LDAP Injection in mitmproxy (medium 4.8)

## Fix prompt for AI coding agents

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

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

Affected packages and fixed versions:
- mitmproxy (PyPI): affected all versions; fixed in 7.0.3
- mitmproxy (PyPI): affected all versions; fixed in 7.0.3
- mitmproxy (PyPI): affected all versions; fixed in 7.0.3

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

## Sources

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

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