← Back to Pull requests

Add LiteLLM proxy pre-auth SQL injection scanner (CVE-2026-42208) #21567

Closed
unknown closed this pull request without merging on Jun 23, 2026 19:40 UTC
View on GitHub
unknown unknown commented on Jun 14, 2026 13:02 UTC
Author

Summary

Adds auxiliary/scanner/http/litellm_proxy_sqli, a detection module for
CVE-2026-42208 (CVSS 9.3,
on the CISA KEV list) — a pre-authentication SQL injection in
BerriAI LiteLLM proxy.

Vulnerability

During API-key verification the proxy interpolates the raw Authorization bearer
value into a PostgreSQL query without parameterization:

WHERE v.token = ''

LiteLLM only SHA-256-hashes bearer tokens that begin with sk-; a value that does
not start with sk- reaches the query verbatim, so a single quote breaks out of
the string literal. The lookup runs on the authentication-failure path, which is
reachable before authentication. Affected versions are 1.81.16 through 1.83.6;
fixed in 1.83.7 by switching to a parameterized query (commit 4dc416ee74).

What the module does

This is a detection module. It confirms the flaw with a benign time-based
check built on the framework's PostgreSQL time-based blind SQLi library
(PostgreSQLi::TimeBasedBlind via create_sqli + test_vulnerable) and never
reads or exfiltrates data.

The library issues a true/false request pair through the injectable Authorization
bearer: one whose injected predicate calls pg_sleep(SqliDelay) only when a
tautology is true, and one whose predicate never sleeps. The target is reported
vulnerable only when the true case is delayed by ~SqliDelay while the false case
returns promptly, so a server that is merely slow (which delays both) is not
flagged. SqliDelay defaults to 5.0s (raised from the library default) for a
clearer remote signal.

Detection requirement: the injectable predicate is a WHERE clause PostgreSQL
evaluates per matching row, so the time-based signal only fires when the target has
provisioned at least one virtual key (a non-empty token table). This is the case
for any LiteLLM proxy in real use; a freshly initialized proxy with no keys may not
respond. The limitation is documented in the module and the docs.

Verification

Tested against the official images — vulnerable main-v1.83.3-stable and patched
main-v1.83.7-stable, each with a PostgreSQL backend and one provisioned virtual
key:

msf6 auxiliary(scanner/http/litellm_proxy_sqli) > set RPORT 4000   # 1.83.3
msf6 auxiliary(scanner/http/litellm_proxy_sqli) > run
[+] 127.0.0.1:4000        - Time-based SQL injection via Authorization header confirmed (LiteLLM 1.83.3)

msf6 auxiliary(scanner/http/litellm_proxy_sqli) > set RPORT 4001   # 1.83.7 (patched)
msf6 auxiliary(scanner/http/litellm_proxy_sqli) > run
[*] 127.0.0.1:4001        - No time-based SQL injection signal observed

check returns Vulnerable / Safe respectively. The module also degrades cleanly
(reports not vulnerable, no errors) against a non-LiteLLM HTTP server and against a
vulnerable proxy whose token table is empty.

Documentation with the full Docker lab setup and scenarios is included at
documentation/modules/auxiliary/scanner/http/litellm_proxy_sqli.md.

Verification Steps

1. Start a vulnerable LiteLLM proxy with a PostgreSQL backend and provision one key (see docs)
2. use auxiliary/scanner/http/litellm_proxy_sqli
3. set RHOSTS
4. run — the module reports the injection when the injected predicate sleeps on true but not on false

Diff: 420 lines (+315 / -105) across 5 files Reviewer: kenlacroix Review duration: 13358m
All Vouch review confidence checks passed
Residual risk 0.31 = Change Risk (0.73) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.73 · 420 lines diff across 5 files
0.73
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
57%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.362
Shallow Review Depth shallow_review_depth
0.289
Sensitive Paths sensitive_paths
0.073
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #21567"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 58.0% reviewed sensitive_module
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 73.2% (HIGH) · Higher = larger blast radius
73.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 58.0% · Lower = rushed or shallow review
58.0%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 30.7% · Safe to merge
30.7%