# CVE-2024-47874: Starlette Denial of service (DoS) via multipart/form-data

> Attackers can cause denial of service in Starlette applications by sending large multipart form fields, exhausting server memory.

- **Severity:** High 8.7 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 Oct 2024
- **Updated:** 21 Nov 2024
- **Also known as:** CLSA-2025-1757031156, CVE-2024-12868, DEBIAN-CVE-2024-47874, GHSA-f96h-pmfr-66vw, PYSEC-2026-1943, ROOT-APP-PYPI-CVE-2024-47874, SUSE-SU-2024:3719-1, UBUNTU-CVE-2024-47874, openSUSE-SU-2024:14417-1, openSUSE-SU-2026:11626-1

## What is CVE-2024-47874?

CVE-2024-47874 is a high-severity denial of service vulnerability in encode starlette, published on 15 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Starlette is an Asynchronous Server Gateway Interface (ASGI) framework/toolkit. Prior to version 0.40.0, Starlette treats `multipart/form-data` parts without a `filename` as text form fields and buffers those in byte strings with no size limit. This allows an attacker to upload arbitrary large form fields and cause Starlette to both slow down significantly due to excessive memory allocations and copy operations, and also consume more and more memory until the server starts swapping and grinds to a halt, or the OS terminates the server process with an OOM error. Uploading multiple such requests in parallel may be enough to render a service practically unusable, even if reasonable request size limits are enforced by a reverse proxy in front of Starlette. This Denial of service (DoS) vulnerability affects all applications built with Starlette (or FastAPI) accepting form requests. Verison 0.40.0 fixes this issue.

Weakness: CWE-770 (Allocation of Resources Without Limits or Throttling)

## Which versions are affected by CVE-2024-47874?

3 open source packages ship an affected version, including starlette.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `starlette` | PyPI | All versions | 0.40.0 |
| `starlette` | PyPI | All versions | 0.40.0 |
| `starlette` | PyPI | All versions | 0.40.0 |
| `python-starlette` | openSUSE:Leap 15.6 | All versions | 0.35.1-150600.3.3.1 |
| `python-starlette` | openSUSE:Tumbleweed | All versions | 0.41.0-1.1 |
| `python-starlette` | openSUSE:Tumbleweed | All versions | 1.6.0-1.1 |

## How do I fix CVE-2024-47874?

Upgrade starlette to 0.40.0 or later.

## Is CVE-2024-47874 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-47874 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-47874 and fix it if it is affected.

What it is: CVE-2024-47874 is a high-severity denial of service vulnerability in encode starlette, published on 15 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-47874 exists.

Affected packages and fixed versions:
- starlette (PyPI): affected all versions; fixed in 0.40.0
- starlette (PyPI): affected all versions; fixed in 0.40.0
- starlette (PyPI): affected all versions; fixed in 0.40.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/CVE-2024-47874/ (Markdown: https://insights.sbomify.com/CVE-2024-47874/index.md)
```

## Sources

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

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