CVE-2026-42271: LiteLLM Authenticated Command Execution Vulnerability

HIGH
Advisory Identifier: GHSA-v4p8-mg3p-g94g
CVSS 8.8
CWE-78 CWE-77
Published
Advisory Summary

CVE-2026-42271 is a HIGH (CVSS 8.8) authenticated command execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting LiteLLM libraries in the PyPI ecosystem. The issue involves authenticated command execution via mcp stdio test endpoints. Remediation is available by upgrading affected packages to version 1.83.7.

CVE-2026-42271 at a Glance

CVE Identifier CVE-2026-42271
GHSA Identifier GHSA-v4p8-mg3p-g94g
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product LiteLLM
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-42271

To remediate this vulnerability, upgrade all affected LiteLLM dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

litellm fixed: 1.83.7
pip install litellm>=1.83.7
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show litellm

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-42271, inspect your installed packages using pip:

pip show litellm

Analyze the terminal output to locate any version of LiteLLM in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.83.7), your application is affected.

Note: The pip show litellm command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In LiteLLM, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact 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. ### Patches Fixed in **`1.83.7`**. Both test endpoints now require the `PROXY_ADMIN` role, bringing them into line with the save endpoint. ### Workarounds If upgrading is not immediately possible, developers should block `POST /mcp-rest/test/connection` and `POST /mcp-rest/test/tools/list` at their reverse proxy or API gateway.

CVE-2026-42271 Affected LiteLLM Versions

1 component(s)
Fixed Versions:
1.83.7
Product / Package Ecosystem Affected Versions Fixed Version
litellm
PyPI
≥ 1.74.2
< 1.83.7
1.83.7

References

Frequently Asked Questions

What is CVE-2026-42271?
CVE-2026-42271 is a security vulnerability in LiteLLM involving Authenticated command execution via MCP stdio test endpoints under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which LiteLLM versions are affected?
Affected versions include releases prior to 1.83.7 across affected packages: litellm.
What version fixes CVE-2026-42271?
Upgrading to 1.83.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is litellm affected?
Yes, litellm is affected in releases prior to 1.83.7. Upgrade your dependency to 1.83.7 or later.
What is the CVSS score of CVE-2026-42271?
CVE-2026-42271 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-42271?
CVE-2026-42271 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check PyPI dependencies for CVE-2026-42271?
Run the dependency tree command: 'pip show litellm'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v4p8-mg3p-g94g",
  "modified" : "2026-06-09T13:07:06Z",
  "published" : "2026-04-25T23:27:54Z",
  "aliases" : [ "CVE-2026-42271" ],
  "summary" : "LiteLLM: Authenticated command execution via MCP stdio test endpoints",
  "details" : "### Impact\n\nTwo 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.\n\nThe 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.\n\n### Patches\n\nFixed in **`1.83.7`**. Both test endpoints now require the `PROXY_ADMIN` role, bringing them into line with the save endpoint.\n\n### Workarounds\n\nIf upgrading is not immediately possible, developers should block `POST /mcp-rest/test/connection` and `POST /mcp-rest/test/tools/list` at their reverse proxy or API gateway.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "litellm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.74.2"
      }, {
        "fixed" : "1.83.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/BerriAI/litellm/security/advisories/GHSA-v4p8-mg3p-g94g"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42271"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/BerriAI/litellm"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/BerriAI/litellm/releases/tag/v1.83.7-stable"
  }, {
    "type" : "WEB",
    "url" : "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-42271"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77", "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-25T23:27:54Z",
    "nvd_published_at" : "2026-05-08T04:16:21Z"
  }
}