CVE-2024-52581 Litestar allows unbounded resource consumption (DoS vulnerability)
An attacker can cause server memory exhaustion and denial of service by sending large multipart form-data requests to applications using the Litestar framework.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-52581?
CVE-2024-52581 is a high-severity denial of service vulnerability in litestar-org litestar, published on 20 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Litestar is an Asynchronous Server Gateway Interface (ASGI) framework. Prior to version 2.13.0, the multipart form parser shipped with litestar expects the entire request body as a single byte string and there is no default limit for the total size of the request body. This allows an attacker to upload arbitrary large files wrapped in a `multipart/form-data` request and cause excessive memory consumption on the server. The multipart form parser in affected versions is vulnerable to this type of attack by design. The public method signature as well as its implementation both expect the entire request body to be available as a single byte string. It is not possible to accept large file uploads in a safe way using this parser. This may be a regression, as a variation of this issue was already reported in CVE-2023-25578. Limiting the part number is not sufficient to prevent out-of-memory errors on the server. A patch is available in version 2.13.0.
Weakness: CWE-770
Which versions are affected by CVE-2024-52581?
6 open source packages ship an affected version, including litestar and starlite. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
litestar PyPI | All versions | 2.13.0 |
litestar PyPI | All versions | 2.13.0 |
litestar PyPI | All versions | 2.13.0 |
starlite PyPI | All versions to 1.51.16 | None |
starlite PyPI | All versions to 1.51.16 | None |
starlite PyPI | All versions to 1.51.16 | None |
Products include Litestar Litestar.
How do I fix CVE-2024-52581?
Upgrade litestar to 2.13.0 or later.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2024-52581 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-52581 exists.
Other vulnerabilities in litestar-org litestar
- CVE-2026-25478 Litestar has a CORS origin allowlist bypass due to unescaped regex metacharacters in allowed origins
- CVE-2026-25479 Litestar has an AllowedHosts validation bypass due to unescaped regex metacharacters in configured host patterns
- CVE-2026-25480 FileStore key canonicalization collisions allow response cache mixup/poisoning (ASCII ord + Unicode NFKD)
Sources
Also known as GHSA-gjcc-jvgw-wvwj, PYSEC-2024-178, PYSEC-2026-1944.