cve-2026-42271litellmai-gatewaycommand-injectionrce

CVE-2026-42271: How a Popular AI Gateway Became an RCE Vector — And What to Audit in Your Stack

BerriAI LiteLLM command-injection flaw (CVSS 8.8) is actively exploited and in CISA KEV. Here's why AI tooling is now supply-chain attack surface and a concr...

Diego Diaz
3 min

The Vulnerability

On May 8, 2026, BerriAI disclosed CVE-2026-42271, a command-injection flaw in LiteLLM — one of the most widely deployed open-source AI gateways. The vulnerability scored CVSS 8.8 and affects every release from version 1.74.2 to before 1.83.7. By June 9, CISA had added it to the Known Exploited Vulnerabilities (KEV) catalog, confirming active exploitation in the wild.

The root cause lives in two MCP-server preview endpoints: POST /mcp-rest/test/connection and POST /mcp-rest/test/tools/list. These endpoints accept a full server configuration in the request body — including the command, args, and env fields used by the stdio transport. When an authenticated user (or an attacker who chains this with the separate Starlette host-header bypass, CVE-2026-48710) sends a crafted payload, the injected command executes on the host with the privileges of the LiteLLM process. No sandboxing. No allowlist. Direct OS-level command execution.

Why This Matters for AI-Heavy Teams

LiteLLM has become the default glue layer for teams building AI-powered products. It normalizes API calls across OpenAI, Anthropic, Google, and dozens of open-weight models. If you've deployed an LLM feature in the last 12 months, there's a non-trivial chance LiteLLM sits somewhere in your stack — in front of your RAG pipeline, your agent framework, or your internal tool-calling layer.

That popularity is exactly what makes this an attack-surface problem, not just a single-CVE problem. The MCP (Model Context Protocol) integration that the vulnerable endpoints serve is the same pattern teams use to connect LLMs to external tools: databases, code execution sandboxes, file systems, APIs. Every MCP server you plug in via stdio transport carries its own command and args. If the gateway doesn't strictly validate those fields, the tool-calling feature becomes a command-injection feature.

The Hacker News reported that the flaw chains to unauthenticated RCE when combined with the Starlette host-header bypass — meaning an attacker who can reach the LiteLLM HTTP interface doesn't even need valid credentials.

What to Audit in Your AI Stack Right Now

If you run LiteLLM (or any AI gateway that proxies model calls and manages tool integrations), here's a concrete checklist:

  • Version check: Are you on LiteLLM ≥ 1.83.7? If not, upgrade immediately. This is a one-line fix in the stdio transport handler.
  • Endpoint exposure: Are /mcp-rest/test/connection and /mcp-rest/test/tools/list reachable from untrusted networks? If you don't use MCP server preview, disable or remove these endpoints entirely.
  • Authentication boundary: Even though CVE-2026-42271 requires authentication on its own, the Starlette bypass (CVE-2026-48710) removes that barrier. Treat the entire LiteLLM HTTP surface as public-facing until both are patched.
  • Process privileges: What user does the LiteLLM process run as? If it's root (common in containerized deployments that haven't been hardened), command injection means full container escape. Run as a non-root user with minimal capabilities.
  • MCP server inventory: List every MCP server your gateway is configured to call. Review the command and args for each. If any accept user-controlled input, that's a second-order injection risk.

The Bigger Pattern: AI Tooling Is Now Supply Chain

This isn't the first time an AI infrastructure component has turned into an attack vector, and it won't be the last. The Hugging Face ecosystem saw two critical CVEs in May 2026 (CVE-2026-0599 and CVE-2026-25874). The pattern is consistent: open-source AI tooling moves fast, security reviews lag, and the resulting components end up in production with the same trust level as a battle-tested web server — without the same hardening.

For early-stage teams especially, the lesson is not "don't use open-source AI tools." It's: every dependency in your AI pipeline needs the same scrutiny you'd give a database driver or an auth library. That means version pinning, CVE monitoring, least-privilege deployment, and network segmentation between your AI gateway and the rest of your infrastructure.

LiteLLM patched this in 1.83.7. The fix is already out. The question is whether your deployment is running it.