Remote Code Execution in LiteLLM’s MCP Stdio Feature (CVE‑2026‑42271)
What Happened — The Zero Day Initiative (ZDI) disclosed a remote‑code‑execution (RCE) flaw in LiteLLM, an open‑source library that provides a lightweight API layer for large‑language‑model (LLM) inference. The vulnerability (CVE‑2026‑42271) scores 7.2 (CVSS v3.1) and resides in the handling of “MCP stdio” configurations. An attacker who can supply a malicious string to the MCP stdio endpoint can cause the service process to execute an arbitrary system command under the service‑account context. Authentication is required, but once a legitimate user (or compromised credential) reaches the endpoint the lack of proper validation enables command injection.
The flaw stems from the library concatenating a user‑controlled string directly into a system() call without sanitisation. The affected code path is invoked when an admin creates or tests a “stdio server” via the LiteLLM management console. Because the console runs with elevated privileges, the injected command inherits those privileges, allowing full control of the host environment.
ZDI reported the issue to the LiteLLM maintainers on 17 June 2026 (ZDI‑26‑1031). After a series of follow‑ups, the vendor initially closed the report as a false positive on 15 September 2026. ZDI disputed the closure, noting that the vendor’s mitigation—an allowlist named CVE‑2026‑42271—did not actually restrict the commands admins could run. The vendor reopened the case on 29 October 2026, acknowledging that the mitigation was insufficient. A fix was promised for the 18 November 2026 advisory deadline, but on 17 November the vendor clarified that no separate patch would be issued and again contested the vulnerability description.
The final advisory, published on 18 November 2026, recommends three mitigations:
- Disable MCP stdio servers by default – Starting with LiteLLM v1.104.0, stdio servers are turned off unless the environment variable
LITELLM_ENABLE_MCP_STDIO=trueis explicitly set (the flag cannot be toggled via API, config file, or database). - Upgrade to v1.104.0 or later – The new release removes the problematic allowlist and enforces the environment‑variable gate.
- Replace default master keys – The library now blocks startup if the master key is missing, empty, or left at the placeholder value
sk-1234. Deployers should generate a strong, random key.
Why It Matters for Trust & Control Assurance — This RCE highlights the need for robust input‑validation and secure configuration controls, a single control objective that satisfies many framework requirements (e.g., NIST CSF 2.0’s “Protect – PR.DS‑5” and ISO 27001’s A.12.5).
Who Is Affected — Organizations that embed LiteLLM in production AI services, including SaaS platforms, internal developer portals, and research labs. The vulnerability is language‑agnostic but most common in cloud‑native deployments that expose the management console to internal users.
Recommended Actions
- Patch immediately – Deploy LiteLLM v1.104.0+ and verify that
LITELLM_ENABLE_MCP_STDIOremains unset unless a tightly controlled admin process is in place. - Enforce strong master‑key policies – Rotate any default keys and enable the startup guard that rejects weak keys.
- Audit admin‑level interfaces – Review who can create or test stdio servers; restrict this capability to a minimal set of privileged accounts and log all actions.
- Add input‑validation tests to CI/CD – Incorporate static‑analysis rules that flag unsanitised system‑call constructions.
- Monitor for anomalous command execution – Deploy host‑level EDR or runtime‑behavior monitoring to detect unexpected process launches from the LiteLLM service account.
Source: ZDI Advisory ZDI‑26‑1031
Technical Notes
- Attack vector: Exploits a command‑injection flaw in the MCP stdio configuration endpoint.
- CVSS v3.1 vector: AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H (Network‑accessible, low complexity, high privileges required).
- Affected component: LiteLLM MCP stdio server handling of user‑supplied strings.
- Mitigation status: Vendor has released v1.104.0 with the vulnerable path disabled by default; no separate patch or GHSA was issued.
- Disclosure timeline: 2026‑06‑17 (report) → 2026‑11‑18 (public advisory).