CVE-2024-52581: Litestar allows unbounded resource consumption (DoS vulnerability)
Summary Litestar offers multiple methods to return a parsed representation of the request body, as well as extractors that rely on those parsers to map request content to structured data types. Multiple of those parsers do not have size limits when reading the request body into memory, which allows an attacker to cause excessive memory consumption on the server by sending large requests.
Published Nov 20, 2024 · Updated Jan 21, 2025
Affected packages
litestar
- Ecosystem
- PyPI
- Affected
- <= 2.12.1
- Fixed in
- 2.13.0
- Check
pip show litestar
starlite
- Ecosystem
- PyPI
- Affected
- <= 1.51.16
- Fixed in
- No patched version yet
- Check
pip show starlite
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
Litestar offers multiple methods to return a parsed representation of the request body, as well as extractors that rely on those parsers to map request content to structured data types. Multiple of those parsers do not have size limits when reading the request body into memory, which allows an attacker to cause excessive memory consumption on the server by sending large requests.
Details
The Request methods to parse json, msgpack or form-data all read the entire request stream into memory via await self.body() without a prior size check or size limit. There may be other places (e.g. extractors) where this can happen.
For most formats, a configurable size limit would be sufficient to mitigate this issue. The total request size can also be limited by a proxy (e.g. nginx) in front of the actual application as a workaround. However, for applications that actually want to accept large file uploads via multipart/form-data, a simple size limit would not be practical. The multipart parser currently used by Litestar expects a single byte string as input and does not support incremental parsing via Request.stream(). Applications could bypass the Litestar parser and use a streaming parser to read from Request.stream() instead, but that would not work with extractors and other features of the framework. Switching the parser for a different implementation is currently not possible via public APIs.
PoC
Start an applications that accesses Request.json(), Request.msgpack() or Request.form() or uses an extractor that relies on those parsers internally, and send a large request with a matching content type. The actual content of the request does not matter. For example: curl -F "foo=</dev/random" http://127.0.0.1:8000/) for multipart/form-data. Server memory consumption will increase very quickly until memory (and swap) are exhausted.
Impact
This is a denial of service (DoS) vulnerability affecting all Litestar applications that process json, msgpack or form-data submission requests.
Credited to defnull.
References
- https://github.com/litestar-org/litestar/security/advisories/GHSA-gjcc-jvgw-wvwj
- https://nvd.nist.gov/vuln/detail/CVE-2024-52581
- https://github.com/litestar-org/litestar/commit/53c1473b5ff7502816a9a339ffc90731bb0c2138
- https://github.com/litestar-org/litestar/blob/main/litestar/_multipart.py#L97
- https://github.com/litestar-org/litestar/security/advisories/GHSA-p24m-863f-fm6q
- https://github.com/pypa/advisory-database/tree/main/vulns/litestar/PYSEC-2024-178.yaml
- https://github.com/advisories/GHSA-gjcc-jvgw-wvwj
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-48060
Litestar has HTML Injection Through its CSRF Token
high8.1Jun 10, 2026CVE-2026-48061
Litestar: AllowedHostsMiddleware bypasses host validation via client-controlled X-Forwarded-Host header
medium5.9Jun 10, 2026CVE-2026-25478
Litestar's CORS origin allowlist has a bypass due to unescaped regex metacharacters in allowed origins
high7.4Feb 9, 2026CVE-2026-25479
Litestar's AllowedHosts has a validation bypass due to unescaped regex metacharacters in configured host patterns
medium6.5Feb 9, 2026CVE-2026-25480
Litestar's FileStore key canonicalization collisions allow response cache mixup/poisoning (ASCII ord + Unicode NFKD)
medium6.5Feb 9, 2026CVE-2025-59152
Litestar X-Forwarded-For Header Spoofing Vulnerability Enables Rate Limit Evasion
high7.5Oct 6, 2025
