# 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.

- **Severity:** High 8.2 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 Nov 2024
- **Updated:** 25 Nov 2024
- **Also known as:** GHSA-gjcc-jvgw-wvwj, PYSEC-2024-178, PYSEC-2026-1944

## 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 (Allocation of Resources Without Limits or Throttling)

## 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 | Ecosystem | 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: Litestar Litestar.

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

Upgrade litestar to 2.13.0 or later.

## 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](https://insights.sbomify.com/CVE-2026-25478/): Litestar has a CORS origin allowlist bypass due to unescaped regex metacharacters in allowed origins (high 7.4)
- [CVE-2026-25479](https://insights.sbomify.com/CVE-2026-25479/): Litestar has an AllowedHosts validation bypass due to unescaped regex metacharacters in configured host patterns (medium 6.5)
- [CVE-2026-25480](https://insights.sbomify.com/CVE-2026-25480/): FileStore key canonicalization collisions allow response cache mixup/poisoning (ASCII ord + Unicode NFKD) (medium 6.5)

## Fix prompt for AI coding agents

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

What it is: 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.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-52581 exists.

Affected packages and fixed versions:
- litestar (PyPI): affected all versions; fixed in 2.13.0
- litestar (PyPI): affected all versions; fixed in 2.13.0
- litestar (PyPI): affected all versions; fixed in 2.13.0
- starlite (PyPI): affected all versions up to 1.51.16; no fix listed
- starlite (PyPI): affected all versions up to 1.51.16; no fix listed
- starlite (PyPI): affected all versions up to 1.51.16; no fix listed

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-52581/ (Markdown: https://insights.sbomify.com/CVE-2024-52581/index.md)
```

## Sources

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

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