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.
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.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20240606-02860/CVE-2024-5225
- https://nvd.nist.gov/vuln/detail/CVE-2024-5225
- https://huntr.com/bounties/491e4884-0306-4cd4-8fe2-9a19de33bf5c
- https://github.com/BerriAI/litellm/pull/3940
- https://github.com/BerriAI/litellm/commit/f75c15d6cd535aa78014378ad532de1df6be2f56
- https://github.com/advisories/GHSA-h6m6-jj8v-94jj
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
