ghsa-f96h-pmfr-66vw
Vulnerability from github
8.7 (High) - 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
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
```python 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"]), ]) ```
sh
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": [ { "package": { "ecosystem": "PyPI", "name": "starlette" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "0.40.0" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2024-47874" ], "database_specific": { "cwe_ids": [ "CWE-770" ], "github_reviewed": true, "github_reviewed_at": "2024-10-15T18:12:57Z", "nvd_published_at": "2024-10-15T16:15:05Z", "severity": "HIGH" }, "details": "### Summary\nStarlette 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.\n\n### PoC\n\n```python\nfrom starlette.applications import Starlette\nfrom starlette.routing import Route\n\nasync def poc(request):\n async with request.form():\n pass\n\napp = Starlette(routes=[\n Route(\u0027/\u0027, poc, methods=[\"POST\"]),\n])\n```\n\n```sh\ncurl http://localhost:8000 -F \u0027big=\u003c/dev/urandom\u0027\n```\n\n### Impact\nThis Denial of service (DoS) vulnerability affects all applications built with Starlette (or FastAPI) accepting form requests.\n", "id": "GHSA-f96h-pmfr-66vw", "modified": "2024-10-15T19:56:06Z", "published": "2024-10-15T18:12:57Z", "references": [ { "type": "WEB", "url": "https://github.com/encode/starlette/security/advisories/GHSA-f96h-pmfr-66vw" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-47874" }, { "type": "WEB", "url": "https://github.com/encode/starlette/commit/fd038f3070c302bff17ef7d173dbb0b007617733" }, { "type": "PACKAGE", "url": "https://github.com/encode/starlette" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N", "type": "CVSS_V3" }, { "score": "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", "type": "CVSS_V4" } ], "summary": "Starlette Denial of service (DoS) via multipart/form-data" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.