LiteLLM MCP test-endpoint command injection chained to unauthenticated RCE (CVE-2026-42271)
Disclosed vulnerability20 Apr 2026 – 08 Jun 2026CVE-2026-42271 is a command-injection flaw in BerriAI's LiteLLM, the open-source AI gateway/proxy routing across many LLM providers. Per the maintainers' advisory and Horizon3.ai, two endpoints meant to preview an MCP server before saving — POST /mcp-rest/test/connection and POST /mcp-rest/test/tools/list — accepted a full stdio server config (command, args, env) and, when invoked, spawned the supplied command as a subprocess on the proxy host as the LiteLLM process user. CVSS reportedly 8.7; affects versions >= 1.74.2 and < 1.83.7; patched in 1.83.7 (reportedly released 8 May 2026). As disclosed 20 Apr 2026 it required a valid proxy API key; Horizon3.ai then showed chaining CVE-2026-48710 (a Starlette 'BadHost' Host-header validation bypass, <= 1.0.0, disclosed 26 May 2026) sidesteps auth entirely for unauthenticated RCE (combined CVSS reportedly 10.0), validated 1 Jun 2026. On 8 Jun 2026 CISA added CVE-2026-42271 to its Known Exploited Vulnerabilities catalog citing in-the-wild exploitation. Successful exploitation runs arbitrary commands on the gateway host and reaches the multi-provider LLM API keys the proxy concentrates. Distinct from the March 2026 TeamPCP PyPI supply-chain compromise: here the shipped gateway itself acts as a confused deputy executing an attacker-supplied MCP 'connection test' command. Figures, CVSS scores and the exploitation assessment are as reported; endpoint and payload details are illustrative.
Risks it illustrates
Sources
- CVE-2026-42271: LiteLLM Unauthenticated RCE (chained with CVE-2026-48710) — Horizon3.ai ↗
- LiteLLM Flaw CVE-2026-42271 Exploited in the Wild, Chains to Unauthenticated RCE — The Hacker News ↗
- CSA Research Note: LiteLLM CVE-2026-42271 AI-Gateway Exploitation — Cloud Security Alliance Labs ↗
- Known Exploited Vulnerabilities Catalog (CVE-2026-42271) — CISA ↗
Practise the risk class — related scenarios
Interactive simulations of the risk class this case illustrates (not a re-enactment of this specific event).
A text-to-SQL agent runs the model's output straight at the database
A fake Sentry error report hijacks a developer's coding agent into running a shell command
A 'safe' dataset preview turns an upload into code execution on the pipeline's workers
An attacker plants prompt injection in the audit trail — so the LLM that hunts them erases the evidence
Encoded public text is laundered across an agent handoff into an on-chain transfer
A poisoned web page hijacks a research agent — and the planner acts on its behalf
A GUI agent clicks 'Continue' — but the screen moved, and it lands on 'Send'