The API endpoints „/key/block“ and „/key/unblock“ are both vulnerable to an SQL injection due insufficient sanitization of the „key“ parameter.
Introduction
LiteLLM is described as an AI Gateway to provide model access, fallbacks and spend tracking across 100+ LLMs. All in the OpenAI format. (Source)
Description
The „key“ parameter („token“ variable in the code) is used without prior sanitization:
While the „token“ variable is usually a hashed version of the access token, „/key/block“ and „/key/unblock“ do not hash the supplied token, if it does not start with „sk-„:
NSIDE decided to publish this vulnerability, since the vendor did neither acknowledge this finding nor implement any remediation several months after being notified.
Proof of Concept
Setup the test environment:
Python script to retrieve password hashes:
Python script to read files from the remote server:
To obtain remote code execution via SELECT statements, a technique disclosed by @adeadfed can be used.
Preparation:
Python script to obtain remote code execution:
Risk
This vulnerability may allow administrators (or low privileged users, if configured) to access sensitive data stored in the database (e.g. password hashes), access the file system of the database server or even get remote code execution on the database server.
Solution/Mitigation
Since the vendor did not acknowledge these vulnerabilities, no official patch is available.
NSIDE recommends the following measures:
- Restrict permissions of the database user to prevent access to the local file system.
- Do not grant low-privileged users access to the vulnerable endpoints „/key/block“ and „/key/unblock“
Disclosure Timeline
2025-06-10: Tried to contact vendor via email according to reporting guidelines
defined in the security.md of the project
2025-06-13: Tried to contact vendor again via email
2025-06-17: Tried to contact vendor again via email
2025-06-19: Vulnerability reported to vendor via huntr.com
2025-08-07: Tried to contact vendor again via email
2025-08-07: Received email from vendor asking for link to the huntr.com report
2025-08-08: Shared corresponding link to the vendor via email
2025-08-14: Asked vendor for follow-up via email
2025-09-01: Asked vendor for follow-up via email
2025-09-19: Audomatic disclosure by huntr.com due to inactivity of the vendor
2026-01-23: Advisory published by NSIDE
Contact/Credits
The vulnerability was discovered during an assessment by Jesse Strathmann of NSIDE ATTACK LOGIC GmbH.
Disclaimer
The information in this security advisory is provided „as is“ and without warranty of any kind. Details of this security advisory may be updated in order to provide as accurate information as possible. The most recent version of this security advisory can be found at NSIDE ATTACK LOGIC GmbH’s website (https://www.nsideattacklogic.de/).
