PyPI: litellm

CVE-2024-5225

Safety vulnerability ID: SFTY-20240606-02860

Safety legacy ID: pyup.io-71723

Affected versions of the litellm package are vulnerable to SQL Injection attacks due to improper input sanitization. The /global/spend/logs endpoint constructs an SQL query by directly concatenating the unvalidated api_key parameter into the query string without escaping or parameterization. This allows attackers to inject arbitrary SQL code by supplying specially crafted input through the api_key parameter. Successful exploitation may lead to unauthorized data access, manipulation of database contents, exposure of sensitive information, or a Denial of Service (DoS) condition.

Created at: Jul 5, 2026Updated at: Jul 5, 2026

Overview

SQL injection in litellm

Advisory

Affected versions of the litellm package are vulnerable to SQL Injection attacks due to improper input sanitization. The /global/spend/logs endpoint constructs an SQL query by directly concatenating the unvalidated api_key parameter into the query string without escaping or parameterization. This allows attackers to inject arbitrary SQL code by supplying specially crafted input through the api_key parameter. Successful exploitation may lead to unauthorized data access, manipulation of database contents, exposure of sensitive information, or a Denial of Service (DoS) condition.

Affected Package

Affecting litellm package, versions>=1.28.3,<1.40.0

Also affects

---

How to Fix

Upgradelitellmto1.40.0or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more