CVE-2026-42208: Pre-Authentication SQL Injection in LiteLLM Proxy
A pre-authentication SQL injection in LiteLLM's proxy allowed an unauthenticated attacker to inject SQL into the PostgreSQL backend via the bearer token, using time-based blind techniques to extract sensitive data such as virtual keys and team bindings. Exploitation was observed in the wild within 36 hours of the advisory.
bishopfox.com
Published on bishopfox.com
Bishop Fox researchers reproduced a critical pre-authentication SQL injection vulnerability affecting BerriAI's LiteLLM proxy in versions 1.81.16 through 1.83.6. LiteLLM is an open-source AI gateway that exposes OpenAI-compatible endpoints in front of more than 100 model providers and is increasingly common as the…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The authentication helper interpolated the raw bearer token directly into an SQL query string using an f-string instead of a parameter placeholder, and a conditional hashing helper only sanitised tokens starting with 'sk-'.
Impact
An unauthenticated attacker could read and write every LiteLLM-managed table, including all active virtual keys, team bindings, and budget caps; the attack is hard to detect because responses look like normal 401 errors and logs resemble client misconfiguration.
What the attacker needed
LiteLLM proxy versions 1.81.16 to 1.83.6; PostgreSQL backend (default); disable_error_logs set to false (default); Network access to an LLM API route
The fix
The vulnerability was fixed in version 1.83.7 by using a positional placeholder for the token in the combined-view query and rewriting the deprecated-token lookup with Prisma's typed API.
How it was found
- Send a POST request to an LLM API route such as /v1/chat/completions with a crafted Authorization bearer that does not start with 'sk-' and contains a time-delay SQL payload.
- Observe that the response is a standard HTTP 401 but takes about six seconds instead of under 100 milliseconds.
- Repeat the request two or three times to rule out network jitter or a WAF tarpit.
- Use the timing difference with a binary-search technique to extract data from the LiteLLM_VerificationToken table.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
LiteLLM is a gateway that sits in front of many AI model providers and checks API keys before letting requests through. A mistake in how it built a database query meant an attacker could send a specially crafted key that made the database pause for several seconds, revealing information bit by bit. No login was needed, and the only visible sign was a slower response.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.