Starlette Denial of service (DoS) via multipart/form-data
Summary
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.
PoC
from starlette.applications import Starlette
from starlette.routing import Route
async def poc(request):
async with request.form():
pass
app = Starlette(routes=[
Route('/', poc, methods=["POST"]),
])
curl http://localhost:8000 -F 'big=</dev/urandom'
Impact
This Denial of service (DoS) vulnerability affects all applications built with Starlette (or FastAPI) accepting form requests.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Python (PyPI) | starlette | < 0.40.0 | 0.40.0 |
References
- https://github.com/encode/starlette/security/advisories/GHSA-f96h-pmfr-66vw
- https://nvd.nist.gov/vuln/detail/CVE-2024-47874
- https://github.com/encode/starlette/commit/fd038f3070c302bff17ef7d173dbb0b007617733
- https://github.com/encode/starlette
- https://pypi.org/project/starlette
- https://github.com/advisories/GHSA-f96h-pmfr-66vw
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N- Weakness (CWE)
CWE-770- Platform
- Python (PyPI)
- Package
starlette- Disclosed
- 15.10.2024
- Updated
- 11.10.2026 15:17
Sources and licenses
OSV / GitHub Advisory Database - PYSEC-2026-1943 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-f96h-pmfr-66vw - CC BY 4.0
Vulnerability history: starlette
All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 10
- First → latest
- 02.2023 06.2026
- Without a fix
- 0
- Exploited in attacks
- 1
Severity breakdown
- High 5
- Medium 4
- Low 1
Disclosures per year
- 2023: 2
- 2024: 1
- 2025: 2
- 2026: 5
-
Starlette Denial of service (DoS) via multipart/form-data this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.