This module exploits CVE-2026-42271, a command execution vulnerability in the BerriAI LiteLLM proxy. The MCP "test" REST endpoints (POST /mcp-rest/test/connection and POST /mcp-rest/test/tools/list), used by the admin UI to preview an MCP server before saving it, accept a full server configuration in the request body. When the supplied transport is "stdio", LiteLLM builds an MCP client that spawns the provided command with its args as a subprocess on the proxy host. On affected versions both endpoints are gated only by user_api_key_auth and the stdio command is unrestricted, so any caller holding a valid virtual key - including a low-privilege, non-admin key - can reach the spawn path and run arbitrary commands as the LiteLLM proxy process. LiteLLM 1.83.7 fixed this with two controls: it requires the PROXY_ADMIN role on both endpoints (a non-admin key now receives HTTP 403), and it restricts the stdio command to an allowlist of interpreters (deno, docker, node, npx, python, python3, uvx), so an arbitrary command such as /bin/sh is rejected with HTTP 422 regardless of role. Affected versions are 1.74.2 through 1.83.6 (fixed in 1.83.7). This module targets the privilege boundary the CVE describes and expects a non-admin APIKEY. When chained with the Starlette host-header authentication bypass (CVE-2026-48710) the same primitive becomes pre-authentication; that bypass is out of scope for this module, which requires a valid virtual key. The command runs blind: the spawned process is not an MCP server, so the endpoint reports a connection failure after the command has already executed. Use a payload that calls back (for example a reverse shell or a fetched stager) rather than one whose output is read from the response.
Vulnerability
CVE-2026-42271
LiteLLM: Authenticated command execution via MCP stdio test endpoints
Vulnerability details
- Score
- 8.7
- Severity
- high
CVSS 4.0 · GitHub_M
Vector string
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:N/SA:NDescription
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.
CVE ProgramExploit source choices
2 sourcesThe code for personally reproducing the corresponding vulnerability