LiteLLM CVE-2026-40217 flaw exploited in attacks

A flaw in the LiteLLM AI gateway, tracked as CVE-2026-40217, is being actively exploited, the US cybersecurity agency CISA confirmed when it added the bug to its Known Exploited Vulnerabilities catalog on 18 November 2026. Attackers have used the flaw in LLMjacking campaigns to turn limited AI access keys into full administrative control of the gateway, according to Google's threat intelligence team. US federal agencies must fix it by 2 December 2026, and any organisation running an unpatched LiteLLM proxy should upgrade now.
LiteLLM is an open-source proxy that sits between applications and AI providers such as OpenAI, Anthropic and Google, handing out limited virtual keys so users can call models without holding the master credential. That makes it a valuable target: it stores provider keys, the master key and usage records. Security researchers report that the bug lets an attacker escape the sandbox around LiteLLM's custom-code guardrails and run arbitrary code in the proxy process, which in the default Docker image runs as root.
How the CVE-2026-40217 sandbox escape works
LiteLLM lets administrators write guardrails in Python, small functions that check each request or response. A test endpoint, POST /guardrails/test_custom_code, runs that code against a sample input so administrators can try it before saving it. Versions 1.81.8 to 1.83.9 ran the code inside a hand-built sandbox that scanned the source text for banned words such as import, __globals__ and os.
German security firm X41 D-Sec, which found the bug, showed the text filter could be fooled by building banned names out of string pieces at runtime, then rewriting the bytecode of a small generator function to reach into a helper function LiteLLM hands the sandbox and pull out Python's real __import__. From there, an attacker can import anything and run code. The flaw scores 8.8 on CVSS 3.1. The fix replaced the text filter with RestrictedPython, and shipped in LiteLLM 1.83.11 or later; researchers note the complete fix set arrived in 1.83.14-stable, so upgrading to a current release is the safest course. Administrators should not land on 1.107.0, a release that shipped a credential stealer in October and is no longer served by PyPI.
LLMjacking: stolen AI access sold on
Google Threat Intelligence Group reported that attackers used the flaw in LLMjacking campaigns, escalating a restricted virtual key into a full administrative credential for the proxy. LLM Hacking's analysis of the incident notes that Google's reporting describes attackers starting from stolen or purchased virtual keys and keeping a foothold on AI gateways. In LLMjacking, attackers run model workloads on the victim's bill, then resell that access as cheap API deals. Google and Mandiant reported fraudulent charges above $100,000 in a single day in some incidents, with the worst case reaching about $1 million before access was cut off.
Exploitation needs administrative access to the proxy, so an exposed LiteLLM instance with weak or shared admin credentials is the main risk. The proxy should never be reachable from the internet without authentication, and the test endpoint can be blocked at a reverse proxy as a stopgap. Teams should inventory every LiteLLM instance, including staging and developer machines, check the version inside each running container rather than a manifest, upgrade, restart the proxy, and rotate any provider keys and the master key that may have been exposed.
Frequently asked questions
What is CVE-2026-40217? It is a sandbox escape in the BerriAI LiteLLM AI gateway. A flaw in the custom-code guardrail test endpoint lets an attacker run arbitrary code in the proxy process. CISA added it to its Known Exploited Vulnerabilities catalog on 18 November 2026.
Which LiteLLM versions are affected by CVE-2026-40217? Versions 1.81.8 to 1.83.9 are affected. The fix shipped in 1.83.11 or later, and researchers say the complete fix set is in 1.83.14-stable.
What is LLMjacking? Attackers steal an organisation's paid access to large language models, run workloads on the victim's bill, and resell the access. Google Threat Intelligence Group linked CVE-2026-40217 to LLMjacking campaigns.