CVE-2026-42271: LiteLLM: RCE via MCP test endpoint command injection
HIGH ACTIVELY EXPLOITED NUCLEI TEMPLATE CISA: ACTLiteLLM's MCP server testing endpoints accept arbitrary stdio command configurations and spawn them as subprocesses on the proxy host without any role check — any holder of a low-privilege internal-user API key can execute arbitrary OS commands. For organizations running LiteLLM as their AI gateway, the blast radius is severe: the proxy typically holds API keys for every LLM provider in your stack, and full RCE means an attacker walks away with all of them. The package carries 18 CVEs in its history and an OpenSSF score of only 6.2/10, indicating structural security debt; while EPSS sits at 0.00047 with no observed exploitation, the trivially-low barrier (any valid API key, single POST request) makes that window short. Upgrade to LiteLLM 1.83.7 immediately, or block POST /mcp-rest/test/ endpoints at your reverse proxy layer until you can patch.
What is the risk?
High risk for any LiteLLM deployment exposed to untrusted users or multi-tenant API key holders. The attack requires only a valid API key with no admin role — CVSS 8.8 accurately reflects the low complexity and low privilege requirements. The proxy host is a high-value target given its access to all configured LLM provider credentials, request/response logs containing potentially sensitive prompts, and internal network positioning. Seventeen prior CVEs in the same package suggest a recurring pattern of insufficient input validation.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| LiteLLM | pip | — | No patch |
Do you use LiteLLM? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
Patch: Upgrade litellm to ≥1.83.7 immediately.
-
If patching is not possible: block POST /mcp-rest/test/connection and POST /mcp-rest/test/tools/list at the WAF or reverse proxy layer.
-
Audit all API key holders and revoke keys issued to untrusted or external parties.
-
Rotate all LLM provider API keys configured in the proxy as a precaution if prior exploitation cannot be ruled out.
-
Detection: Review proxy logs for POST requests to /mcp-rest/test/ endpoints containing command, args, or env fields in the request body.
-
Harden the proxy process to run as a non-root user with a restricted filesystem and outbound network controls to limit post-exploitation impact.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
How many AI incidents are linked? (1)
AI Threat Alert incident classification, derived from public security reporting. Each item links to its original source.
Frequently Asked Questions
What is CVE-2026-42271?
LiteLLM's MCP server testing endpoints accept arbitrary stdio command configurations and spawn them as subprocesses on the proxy host without any role check — any holder of a low-privilege internal-user API key can execute arbitrary OS commands. For organizations running LiteLLM as their AI gateway, the blast radius is severe: the proxy typically holds API keys for every LLM provider in your stack, and full RCE means an attacker walks away with all of them. The package carries 18 CVEs in its history and an OpenSSF score of only 6.2/10, indicating structural security debt; while EPSS sits at 0.00047 with no observed exploitation, the trivially-low barrier (any valid API key, single POST request) makes that window short. Upgrade to LiteLLM 1.83.7 immediately, or block POST /mcp-rest/test/ endpoints at your reverse proxy layer until you can patch.
Is CVE-2026-42271 actively exploited?
Yes, CVE-2026-42271 is confirmed actively exploited and listed in CISA Known Exploited Vulnerabilities catalog since Mon Jun 08 2026 00:00:00 GMT+0000 (Coordinated Universal Time).
How to fix CVE-2026-42271?
1. Patch: Upgrade litellm to ≥1.83.7 immediately. 2. If patching is not possible: block POST /mcp-rest/test/connection and POST /mcp-rest/test/tools/list at the WAF or reverse proxy layer. 3. Audit all API key holders and revoke keys issued to untrusted or external parties. 4. Rotate all LLM provider API keys configured in the proxy as a precaution if prior exploitation cannot be ruled out. 5. Detection: Review proxy logs for POST requests to /mcp-rest/test/ endpoints containing command, args, or env fields in the request body. 6. Harden the proxy process to run as a non-root user with a restricted filesystem and outbound network controls to limit post-exploitation impact.
What systems are affected by CVE-2026-42271?
This vulnerability affects the following AI/ML architecture patterns: AI gateway / LLM proxy deployments, Multi-tenant LLM API routing infrastructure, Agent frameworks using LiteLLM as backend router, Enterprise AI API management platforms, MCP server integrations.
What is the CVSS score for CVE-2026-42271?
CVE-2026-42271 has a CVSS v3.1 base score of 8.8 (HIGH). The EPSS exploitation probability is 53.70%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0012 Valid Accounts AML.T0049 Exploit Public-Facing Application AML.T0050 Command and Scripting Interpreter AML.T0055 Unsecured Credentials AML.T0072 Reverse Shell Compliance Controls Affected
What are the technical details?
Original Advisory
LiteLLM is a proxy server (AI Gateway) to call LLM APIs in OpenAI (or native) format. From version 1.74.2 to before version 1.83.7, two endpoints used to preview an MCP server before saving it — POST /mcp-rest/test/connection and POST /mcp-rest/test/tools/list — accepted a full server configuration in the request body, including the command, args, and env fields used by the stdio transport. When called with a stdio configuration, the endpoints attempted to connect, which spawned the supplied command as a subprocess on the proxy host with the privileges of the proxy process. The endpoints were gated only by a valid proxy API key, with no role check. Any authenticated user — including holders of low-privilege internal-user keys — could therefore run arbitrary commands on the host. This issue has been patched in version 1.83.7.
Exploitation Scenario
An attacker with a low-privilege LiteLLM internal-user API key — obtained via a leaked key in a code repository, insider access, or credential stuffing — sends a single POST to /mcp-rest/test/connection with a JSON body specifying stdio transport and a malicious command (e.g., curl-piped reverse shell). LiteLLM spawns this as an OS subprocess at proxy-process privilege level. The attacker receives a shell on the proxy host, reads environment variables and config files to harvest all LLM provider API keys (OpenAI, Anthropic, Azure, etc.), and pivots to internal services reachable from the proxy network. The entire AI infrastructure is now impersonatable by the adversary.
Weaknesses (CWE)
CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')
Primary
CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Primary
CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection') CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') CWE-77 — Improper Neutralization of Special Elements used in a Command ('Command Injection'): The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
- [Architecture and Design] If at all possible, use library calls rather than external processes to recreate the desired functionality.
- [Implementation] If possible, ensure that all external commands called from the program are statically created.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H References
Timeline
Scanner Template Available
A Nuclei vulnerability scanner template exists for this CVE. You can scan your infrastructure for this vulnerability immediately.
View template on GitHubnuclei -t http/cves/2026/CVE-2026-42271.yaml -u https://target.example.com Related Vulnerabilities
CVE-2026-42208 9.8 LiteLLM: SQL injection exposes LLM API credentials
Same package: litellm CVE-2026-54352 9.6 Budibase: zip symlink bypass exposes all server secrets
Same package: litellm CVE-2026-35030 9.1 LiteLLM: auth bypass via JWT cache key collision
Same package: litellm CVE-2026-40217 8.8 LiteLLM: RCE via bytecode rewriting in guardrails API
Same package: litellm CVE-2024-6825 8.8 LiteLLM: RCE via post_call_rules callback injection
Same package: litellm