deniz.in

Markets

Weather

Loading weather

· via dev.to (home feed)

Attackers scan for unauthenticated LiteLLM RCE chaining CVE-2026-42271 with Starlette BadHost

SANS honeypots are recording exploit traffic that chains a LiteLLM command-injection flaw with a Starlette Host-header bug into unauthenticated remote code execution. Fixes for both issues have been available since mid-2026.

Attackers scan for unauthenticated LiteLLM RCE chaining CVE-2026-42271 with Starlette BadHost

Honeypots operated by the SANS Internet Storm Center captured targeted requests over the weekend of November 14 and 15 that, on an unpatched self-hosted LiteLLM proxy, achieve remote code execution without any valid credentials. Johannes Ullrich described the traffic in a SANS ISC diary entry on November 16, and a longer analysis published on dev.to on November 24 reconstructs the bug chain and the mitigations.

The probes are simple. Each is a POST to one of LiteLLM's MCP test endpoints, carrying a meaningless bearer token, a body that supplies an MCP server configuration whose stdio transport defines an attacker-chosen shell command, and a deliberately malformed Host header. According to SANS, on a vulnerable proxy that combination is enough to execute code with no authentication at all.

Two bugs chained into one exploit

The chain joins flaws in two separate projects.

CVE-2026-42271 sits in the LiteLLM proxy. Its MCP test endpoints, /mcp-rest/test/connection and /mcp-rest/test/tools/list, accept a complete MCP server configuration, including the command, arguments and environment variables for the stdio transport, then launch that command as a subprocess on the proxy host. The flaw was disclosed in April 2026 and was initially treated as authenticated-only, because the endpoints check for a valid proxy API key. Versions 1.74.2 through 1.83.6 are affected, with a fix shipped in 1.83.7 in May 2026.

CVE-2026-48710, nicknamed BadHost, affects Starlette releases before 1.0.1. The framework builds the full request URL from the Host header, and that header is not validated, so characters such as slashes, question marks, hash signs and square brackets change how the resulting URL is parsed.

In June, Horizon3 demonstrated that the Starlette flaw defeats the authentication check in front of the LiteLLM endpoints, turning an authenticated command-injection bug into unauthenticated remote code execution. The combined issue scores 10.0 on the CVSS scale according to Horizon3, and injected code runs with the privileges of the LiteLLM process — a position that, on a typical gateway, exposes every upstream provider key the proxy stores.

Why the malformed Host header works

Starlette-based applications often authorize requests by inspecting the URL the framework reconstructed from headers, while the router dispatches on the raw request path. The dev.to author reproduced the bug class with a minimal Starlette application: when the Host header ended in a public path fragment followed by a question mark, the middleware believed the request targeted a public path and let it through, yet the router still served the protected endpoint, because the two components compared different values.

In that test application, the bracket-shaped variants seen in the wild triggered URL-parsing errors rather than bypasses. That does not make them harmless. Per SANS, attackers are cycling through these variants specifically to slip past filters written for the original proof-of-concept characters, and the outcome depends on how each target parses and handles malformed URLs.

How to close the gap

Two updates end the chain: run LiteLLM 1.83.7 or newer, and Starlette 1.0.1 or newer. The dev.to author confirmed that current Starlette, 1.10.0 at the time of writing, rejected every probe with no application changes.

For teams pinned to a vulnerable Starlette by a locked dependency or a frozen release branch, two independent changes each blocked all tested probes in the dev.to experiments:

  • Authorize on the path value the router actually dispatches, rather than the URL rebuilt from headers, so the security check and the router read the same string.
  • Add a trusted-host middleware with an explicit allow-list ahead of authentication, so unexpected Host values are rejected before any access-control logic runs.

Because FastAPI is built on Starlette, the warning extends beyond LiteLLM deployments to any Python API on that stack.

Why it matters

LiteLLM gateways are attractive targets because they concentrate credentials for many model providers behind a single service. Code execution on the proxy host therefore threatens not just the machine but every API key it holds, keys that are frequently powerful and billed to a company account.

The traffic SANS observed is scanning and exploitation attempts, not confirmed mass compromise, but it shows attackers are hunting for vulnerable instances months after patches became available. Self-hosted deployments are the exposed population: anyone running a LiteLLM proxy, or a Starlette- or FastAPI-based service, should verify versions now and, if an upgrade is impossible, apply one of the header-hardening workarounds described above.

  • #litellm
  • #starlette
  • #fastapi
  • #security
  • #remote-code-execution

Related posts