stable AI Gateway Security · Research

AI Gateway Compromise: Chained Starlette and LiteLLM Flaws Expose Foundation Model Keys

Data graphic: "AI gateway: two could chain". Three CISA KEV cards: CVE-2026-48710 CVSS v3.1 6.5 linked by "chain" to CVE-2026-42271 CVSS v3.1 8.8, v4.0 8.7 ; CVE-2026-59822 CVSS v3.1 8.2, v4.0 8.8 marked not linked.
AK

Threat intelligence editor · Published Sep 5, 2026 · Updated Oct 7, 2026, 8:00 PM EDT

Threat actors chain Starlette and LiteLLM flaws to achieve unauthenticated RCE and steal enterprise AI keys. Discover key forensic details and patch steps.

Threat actors are actively weaponizing a critical vulnerability chain spanning the Starlette ASGI framework and the LiteLLM proxy gateway to execute unauthenticated remote code execution and harvest upstream enterprise artificial intelligence credentials. The campaign targets centralized AI control planes, prompting the Cybersecurity and Infrastructure Security Agency to list the flaws in its Known Exploited Vulnerabilities catalog. CISA added CVE-2026-48710 and CVE-2026-59822 on September 2, 2026, each with a federal remediation deadline of September 16, 2026; CVE-2026-42271 had already been added on June 8, 2026.

Correction (October 5, 2026): An earlier version of this article listed CVE-2026-59822 as "Honeypot Probing" and as probed by ransomware affiliates. CISA had in fact added it to the KEV catalog on September 2, 2026, three days before this article was published, and CISA lists its known ransomware campaign use as "Unknown". The earlier version also gave CVE-2026-59822 a CVSS score of 9.8; NVD lists 8.2 (CVSS v3.1, NVD) and 8.8 (CVSS v4.0, GitHub CNA). The intro also implied CISA added all the flaws on September 2; CVE-2026-42271 was added on June 8, 2026. The scores in the table are now labelled with their CVSS version. Unsourced "chained" CVSS scores of 10.0 have been removed. The article's illustration has been replaced.

Rather than functioning as passive HTTP forwarders, modern AI gateways operate as high-privilege clearinghouses. LiteLLM has faced this exposure before too, in a separate pre-auth SQL injection flaw exposing AI gateway secrets. Deployments running LiteLLM aggregate master credentials for external model providers—including OpenAI, Anthropic, and Azure OpenAI—alongside database strings and internal routing topologies. While proprietary foundation model weights and training datasets remain isolated on provider infrastructure, compromising the gateway surrenders the cryptographic keys, virtual tenant tokens, and administrative access that govern enterprise AI workflows.

IdentifierComponentVulnerability TypeCVSS (version)Status in the WildOperational Role in Chain
CVE-2026-48710Starlette ≤ 1.0.0Host Header Validation / Path Confusion6.5 (v3.1)Active ExploitationEnabler: Bypasses path-based authentication middleware via crafted Host headers.
CVE-2026-42271LiteLLM 1.74.2–1.83.6Remote Command Injection in MCP stdio testing8.8 (v3.1, NVD); 8.7 (v4.0, GitHub)Active ExploitationExecution Sink: Spawns unvalidated child processes via Model Context Protocol testing routes.
CVE-2026-59822LiteLLM < 1.84.0Streamable HTTP MCP Auth Bypass8.2 (v3.1, NVD); 8.8 (v4.0, GitHub)Added to CISA KEV 2026-09-02Separate authentication flaw in LiteLLM's MCP Streamable HTTP endpoint. CISA's KEV entry for CVE-2026-48710 names CVE-2026-42271 as the flaw it can be chained with; no primary source links CVE-2026-59822 to that chain.

Anatomy of the Exploit Chain: BadHost to Subprocess Execution

The intrusion chain couples an architectural mismatch in Python Asynchronous Server Gateway Interface (ASGI) request handling with an unvalidated command sink in LiteLLM's Model Context Protocol (MCP) suite.

In ASGI web stacks powered by Uvicorn or Hypercorn, incoming requests populate the underlying scope dictionary: the request line populates scope["path"], while client headers reside in scope["headers"]. In Starlette versions 1.0.0 and earlier, the framework synthesized its internal Request.url property by concatenating the raw, unvalidated HTTP Host header directly onto the request path.

# Vulnerable Starlette URL synthesis (starlette/datastructures.py <= 1.0.0)
host_header = dict(scope["headers"]).get(b"host", b"localhost").decode()
url = f"{scope['scheme']}://{host_header}{scope['path']}"

When an attacker submits an HTTP request embedding path and query delimiters within the Host header, URL parsing breaks down:

POST /mcp-rest/test/connection HTTP/1.1
Host: gateway.internal/health?x=
Content-Type: application/json

{
 "command": "bash",
 "args": ["-c", "id > /tmp/pwned"],
 "env": {}
}

Starlette evaluates the combined string http://gateway.internal/health?x=/mcp-rest/test/connection. Standard URI parsing extracts /health as request.url.path, while the true target path becomes an arbitrary query argument.

LiteLLM's authentication middleware evaluates request.url.path against an allowlist of public diagnostic routes, identifying /health and immediately bypassing bearer token verification. However, Starlette and FastAPI dispatch handlers using scope["path"], which remains /mcp-rest/test/connection.

OS Subprocess(MCP Engine)Starlette RouterBaseHTTPMiddlew-areLiteLLM (Starlette<= 1.0.0)OS Subprocess(MCP Engine)Starlette RouterBaseHTTPMiddlew-areLiteLLM (Starlette<= 1.0.0)Parses as "/health"Bypasses Bearer token checksExecutes arbitrarypayload via stdio(CVE-2026-42271-)AttackerPOST/mcp-rest/test/connection(Host:gateway.internal/health?x=)1Evaluates request.url.path2Forwards raw ASGI scope3Dispatches scope["path"] ="/mcp-rest/test/connection"4Remote Code Execution (Container Context)5Attacker

The unauthenticated request reaches the MCP testing endpoint, which was designed to validate external tool integrations over standard input/output (stdio) channels. The endpoint unpacks user-supplied parameters directly into Python's asynchronous process execution primitives without command whitelisting or argument sanitization: MCP tool-calling endpoints carry the same trust problem at a different layer; see architecting zero trust for MCP against tool poisoning and sampling injection.

# Simplified representation of the execution sink in LiteLLM
async def test_mcp_connection(data: MCPTestInput):
 server_params = StdioServerParameters(command=data.command, args=data.args, env={**os.environ, **data.env})
 process = await asyncio.create_subprocess_exec(
 server_params.command, *server_params.args, env=server_params.env,
 stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
 )

This structural failure grants adversaries immediate command execution under the privileges of the running gateway container. A comparable execution-sink flaw hit the AI workflow layer itself in Langflow's unauthenticated RCE that exposed API keys.


Control-Plane Infiltration and Credential Harvesting

Once inside the container environment, threat actors bypass application boundaries to extract infrastructure secrets. Because LiteLLM typically executes as the entrypoint process (PID 1) in containerized deployments, inspecting /proc/1/environ immediately yields plaintext administrative variables, including LITELLM_MASTER_KEY and the relational database connection string (DATABASE_URL).

Adversaries leverage these database coordinates to dump two central PostgreSQL tables: Stolen model-provider access like this is exactly the kind of foothold behind JadePuffer, the first fully agentic AI ransomware campaign.

  1. LiteLLM_ProxyModelTable: Houses the litellm_params JSON object, exposing raw upstream API keys for OpenAI, Anthropic, Azure OpenAI, and AWS Bedrock, along with private enterprise endpoints.
  2. LiteLLM_VerificationToken: Contains proxy-issued virtual API keys, spend limits, allowed model scopes, and internal client team identities.

By obtaining these assets, attackers gain complete operational control over upstream model consumption and downstream API routing, enabling data interception, quota exhaustion, and administrative backdoor insertion without accessing physical model weights.


Threat Actor Profile and Host Persistence

Observed intrusions demonstrate a disciplined post-exploitation lifecycle focused on covert persistence and hardware monetization. Threat actors deploy multi-stage droppers into memory-backed locations such as /dev/shm and /tmp, masquerading binary processes under system names such as python3 [systemd-journald] or kworker_ds.

To maximize Monero mining performance on high-performance compute instances, adversaries tamper with low-level CPU registers via the Linux Model-Specific Register module (modprobe msr), executing wrmsr -a 0xc0011020 0x0 to disable hardware prefetchers for the RandomX algorithm. The actors subsequently terminate rival cryptominers, lock cron entries using the immutable filesystem flag (chattr +i), and append unauthorized Ed25519 public keys to ~/.ssh/authorized_keys.

CategoryForensic IndicatorObservational Behavior
Process Masquerading/dev/shm/.*, /tmp/kworker_dsDroppers disguised as system services running from writable storage.
Kernel Manipulation/dev/cpu/[0-9]+/msrInvocation of wrmsr to alter CPU prefetch registers for cryptomining.
System Persistence/etc/cron.*, ~/.ssh/authorized_keysCrontab modifications and injected SSH keys secured with chattr +i.
Command & ControlTCP Ports 3333, 4444, 14444Outbound Stratum mining protocol streams to external nodes.

Zero-Downtime Key Rotation Strategy

Revoking all compromised credentials simultaneously causes severe operational outages across production AI applications. Engineering teams must deploy an orchestrated, multi-phase key rotation protocol.

Compromise Confirmed

1. Dual-Key Provisioning at Providers

2. In-Memory & Database Parameter Hot-Swap

3. Gateway Restart & Infrastructure Secret Roll

4. Traffic Monitoring & Deprecation of Stolen Keys

5. Rolling Invalidation of Virtual Client Tokens

  1. Dual-Key Provisioning: Generate secondary API keys directly within upstream provider portals (OpenAI, Anthropic, Azure) without deleting the active credentials.
  2. Live Gateway Updates: Hot-swap upstream secrets by updating the litellm_params JSON payload in LiteLLM_ProxyModelTable or invoking LiteLLM's administrative /model/update endpoint, avoiding service interruption.
  3. Infrastructure Secret Cycling: Rotate backend database user passwords, update orchestrator secret manifests (DATABASE_URL, LITELLM_MASTER_KEY), and execute a rolling container rollout (kubectl rollout restart).
  4. Provider Key Decommissioning: Track upstream provider usage logs. Once external request volume across legacy keys flatlines for fifteen consecutive minutes, permanently revoke the compromised credentials.
  5. Virtual Token Re-Keying: Issue replacement virtual tokens across downstream application teams, maintain a 48-hour deprecation window, and purge retired tokens via /key/delete.

Architectural Hardening and Defenses

Mitigating gateway compromise requires defense-in-depth spanning dependency management, ingress normalization, and container sandboxing. On-premises enterprise software carries the same unauthenticated-RCE risk, as seen in the critical unauthenticated RCE hitting Dynamics NAV and Business Central on-premises.

Package Upgrades and Route Deactivation

Platform teams must upgrade Starlette to version 1.0.1 or higher, which enforces strict RFC 3986 validation over Host headers. LiteLLM must be upgraded to version 1.83.7 or later (or ≥ 1.84.0 to address CVE-2026-59822). If testing interfaces are not required in production, disable MCP routes entirely by passing --disable_mcp_endpoints to the CLI or setting DISABLE_MCP_REST=True in container environments.

Reverse Proxy Normalization

Edge proxies must inspect and normalize HTTP headers before traffic reaches ASGI application workers, stripping malformed delimiters:

server {
 listen 443 ssl http2;
 server_name litellm.internal.domain;

 # Drop requests with URI path delimiters in the Host header
 if ($http_host ~* "[\/\?\#\@\:]") {
 return 400 "Malformed Host Header";
 }

 # Block external reachability to internal MCP testing endpoints
 location ~* ^/mcp-rest/test/ {
 deny all;
 return 403;
 }

 location / {
 proxy_pass http://127.0.0.1:4000;
 proxy_set_header Host $host; # Explicitly forward normalized $host
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 }
}

Container Runtime Isolation

To block kernel register manipulation and local persistence, execute AI gateway workloads under hardened container security profiles. Enforcing readOnlyRootFilesystem: true, executing as a non-root UID, and revoking all Linux capabilities (drop: ["ALL"]) prevents the acquisition of CAP_SYS_RAWIO and CAP_SYS_ADMIN. These constraints stop unauthorized kernel module loading, neutralize persistence mechanisms, and secure the operational perimeter surrounding foundation model access.

Related reading

Keep reading

All latest →
  1. stableResearchNemotron 3.5 Bolt vs Super VL: what you need to run each, from a 24 GB GPU to a DGX Spark6 min
  2. watchResearchGitHub Copilot drops Opus 4.8, Opus 5 and GPT-5.6 Terra on 16 November: what each plan switches to4 min
  3. elevatedResearchGemini 4 Argon's API price doubles on 1 December: what $2/$10 becomes, and where you can use it4 min
  4. watchResearchClaude Opus 5.5 fast mode is out of preview: $8/$40 per MTok, twice the standard price4 min
  5. watchResearchDeepSeek starts charging for Search and Fetch on 31 October: $0.75 per 1,000 calls3 min
  6. stableResearchHow to calculate square feet of a room: we tested five AI models9 min