
LiteLLM CVE-2026-40217: Patch the Exploited Guardrail Escape
LiteLLM CVE-2026-40217 is now on CISA's KEV list. See affected versions, the 1.83.11 fix, a version checker we ran, log checks and interview takeaways.
- What happened: CISA added LiteLLM CVE-2026-40217 to the KEV catalog on November 18, 2026.
- Who is affected: LiteLLM proxy 1.81.8 up to 1.83.10 with the custom-code guardrail endpoint reachable.
- What to do now: Upgrade to 1.83.11 or later, or block POST /guardrails/test_custom_code.
- Interview angle: Why in-process language sandboxes fail, and why KEV beats CVSS for patch priority.
LiteLLM CVE-2026-40217 is a sandbox escape in the proxy’s custom-code guardrail test endpoint. Someone holding a proxy-admin credential can run arbitrary code inside the proxy process, which holds your LLM provider keys. CISA now lists it as actively exploited. Upgrade to 1.83.11+, or block the endpoint and audit your logs.
A sandbox escape happens when code that is meant to run with restricted powers breaks out and gains the full powers of its host process. In Python, “sandboxes” built by filtering source code or trimming builtins are known to be weak, because the language exposes many paths to the interpreter’s internals.
The LiteLLM CVE-2026-40217 listing matters because LiteLLM is often the one place a team keeps every model provider key. The bug itself was disclosed in spring 2026. What changed this week is that CISA marked it as exploited. This post covers the fix, a version checker we ran, and the security concepts behind it. For the wider supply-chain picture, see our npm supply chain defence layers guide.
What changed in LiteLLM CVE-2026-40217, and who is affected?
The GitHub advisory GHSA-wxxx-gvqv-xp7p describes a “sandbox escape in custom-code guardrail”. The LiteLLM custom code guardrail lets admins write Python-like checks that run on each request. A test endpoint executed that code in a hand-rolled sandbox, which could be escaped.
| Item | Value | Source |
|---|---|---|
| Affected versions | >= 1.81.8, < 1.83.10 | GitHub advisory |
| Fixed version | 1.83.11 (advisory text); metadata says 1.83.10 | GitHub advisory |
| Endpoint | POST /guardrails/test_custom_code | GitHub advisory |
| Privilege needed | Proxy-admin credential (default config) | GitHub advisory |
| Severity (GitHub) | Moderate, CVSS v4 5.9 | GitHub advisory |
| Severity (reported CVSS v3) | 8.8 | SecurityOnline |
| Added to CISA KEV | November 18, 2026 | CISA alert |
| Federal due date | December 2, 2026 | SecurityOnline |
Two details raise the stakes. The proxy runs as root in the default Docker image. And, per Ostorlab’s analysis, code running there can read the proxy’s environment, including provider API keys, database credentials and the master key. Note the severity gap: GitHub scores it 5.9 on CVSS v4, while SecurityOnline cites 8.8 on CVSS v3. Exploitation status, not the score, should drive your priority.
How does the guardrail sandbox escape work?
At advisory level, the flow looks like this:
- An admin-authenticated request sends guardrail source code to the test endpoint.
- The vulnerable versions checked the code’s text and ran it in the same Python process as the proxy.
- The advisory says the sandbox could be escaped with “bytecode-level techniques”.
- Escaped code runs with the proxy’s full rights: its environment, files and network.
- The fix replaced the hand-rolled sandbox with RestrictedPython.
Ostorlab sums up the root cause: the sandbox filtered the text of the program but could not reliably restrict what it did at runtime. We will not go further into the bypass. The lesson for design reviews is enough: filtering source text is not isolation.
Check your version: a script we ran
We wrote a small classifier for the advisory’s version range and ran it with Python 3.13.18 and packaging 26.3 in our sandbox. It treats 1.83.10 as a grey zone because the advisory contradicts itself.
from packaging.version import Version
from packaging.specifiers import SpecifierSet
AFFECTED = SpecifierSet(">=1.81.8,<1.83.10") # GHSA "Affected versions"
SAFE_MIN = Version("1.83.11") # GHSA "Patches"
def classify(v):
ver = Version(v)
if ver in AFFECTED:
return "VULNERABLE - upgrade to 1.83.11+ or block POST /guardrails/test_custom_code"
if Version("1.83.10") <= ver < SAFE_MIN:
return "GREY ZONE - advisory text disagrees on 1.83.10; move to 1.83.11+"
if ver < Version("1.81.8"):
return "NOT IN RANGE for this CVE - still check other LiteLLM advisories"
return "OK for CVE-2026-40217"
$ python3 check_litellm.py 1.80.0 1.81.8 1.82.3 1.83.9 1.83.10 1.83.11 1.84.0
1.80.0 NOT IN RANGE for this CVE - still check other LiteLLM advisories
1.81.8 VULNERABLE - upgrade to 1.83.11+ or block POST /guardrails/test_custom_code
1.82.3 VULNERABLE - upgrade to 1.83.11+ or block POST /guardrails/test_custom_code
1.83.9 VULNERABLE - upgrade to 1.83.11+ or block POST /guardrails/test_custom_code
1.83.10 GREY ZONE - advisory text disagrees on 1.83.10; move to 1.83.11+
1.83.11 OK for CVE-2026-40217
1.84.0 OK for CVE-2026-40217
Feed it the output of pip show litellm or your container image tag. The “not in range” line is deliberate: older versions carry other LiteLLM advisories.
What should developers do about LiteLLM CVE-2026-40217 right now?
- Inventory. Find every LiteLLM proxy: Docker tags, Helm values,
requirements.txtand lock files. Run the checker above on each version. - Patch. Upgrade to 1.83.11 or later and pin it:
pip install "litellm>=1.83.11". - Mitigate if you cannot patch. Block POST /guardrails/test_custom_code at your reverse proxy or API gateway.
- Hunt. Search LiteLLM and reverse-proxy logs for that path, as Ostorlab suggests. Access logs may not show the request body, so correlate with admin identity and config changes.
- Rotate on doubt. If you see calls you cannot explain, rotate the master key, provider keys and database credentials the proxy can read.
- Shrink the blast radius. Run the container as a non-root user, keep the admin UI off the public internet, and stop sharing the master key in scripts.
If your agents call the proxy with broad keys, our AI agent budget guards guide shows how to scope keys and spend per caller.
Interview questions this update prepares you for
Why is it so hard to sandbox Python inside the same process?
Python is highly introspective. Objects expose their classes, frames, code objects and the interpreter’s internals, so trimming builtins or banning keywords leaves many indirect paths open. Filtering the source text also misses behaviour that only appears at runtime. Real isolation needs a boundary the language cannot cross: a separate process with dropped privileges, a container with seccomp, a microVM, or a WebAssembly runtime. In-process tools like RestrictedPython reduce risk, but defence in depth still matters.
Follow-up they may ask: Where would you draw the trust boundary for user-supplied plugins?
How does CISA’s KEV catalog change patch prioritisation compared with CVSS?
CVSS estimates how bad a flaw could be. KEV records that attackers are actually exploiting it. A moderate CVSS bug with confirmed exploitation is often a bigger real-world risk than an unexploited critical. Many teams rank work as: KEV-listed and internet-facing first, then high EPSS or critical CVSS, then the rest. This LiteLLM CVE is a good example: GitHub scores it 5.9, yet it is on KEV.
Follow-up they may ask: What other signals besides CVSS would you feed into a patch SLA?
Why does an admin-only vulnerability still matter?
Admin credentials leak. They end up in CI variables, notebooks, shared .env files and screenshots. A bug that turns an application-level admin into OS-level code execution crosses a privilege boundary: from managing the app to owning the host and every secret on it. Good designs keep those two levels separate, so a stolen admin key cannot read cloud credentials or pivot into the network.
Follow-up they may ask: How would you limit what a stolen admin key can do?
How would you design a service that runs untrusted user code safely?
Run each job in its own short-lived sandbox: a container or microVM with no secrets mounted, a read-only filesystem, a non-root user, CPU, memory and time limits, and egress denied by default. Pass inputs in and results out over a narrow API. Never execute in the process that holds credentials. Log every execution with the caller’s identity for audit.
Follow-up they may ask: What would you trade off between containers, gVisor and Firecracker?
What makes an LLM gateway a high-value target?
A gateway centralises provider API keys, routing rules, spend limits and request logs. That is convenient, but it also creates a single place to steal everything. Mitigations include keeping keys in a secret manager with short-lived access, separating the admin plane from the data plane, issuing scoped per-team keys, and alerting on unusual spend or new admin actions.
Follow-up they may ask: How would you detect a stolen provider key being used elsewhere?
For agent-side trust boundaries, our AI browser agent security guide covers the same isolation ideas from the client side.
The NexGismo verdict: Treat this CVE as urgent, not “moderate”. My recommendation: patch to 1.83.11+, block the test endpoint at the edge anyway, and move provider keys out of the proxy’s environment where you can. The bigger lesson is that any feature which runs admin-supplied code needs a process boundary, not a filter.
- CISA added this LiteLLM flaw to its KEV catalog on November 18, 2026.
- Affected: litellm 1.81.8 up to 1.83.10; upgrade to 1.83.11 or later.
- The vulnerable endpoint is POST /guardrails/test_custom_code and needs a proxy-admin credential by default.
- The default Docker image runs the proxy as root, so escaped code gets full container rights.
- Source-text filtering is not a sandbox; isolate untrusted code in a separate process or VM.
Frequently Asked Questions
Is LiteLLM CVE-2026-40217 being exploited?
Yes. CISA added CVE-2026-40217 to its Known Exploited Vulnerabilities catalog on November 18, 2026, which means it has evidence of exploitation in the wild. CISA did not name attackers or campaigns. Federal agencies were given until December 2, 2026 to fix it, according to SecurityOnline’s summary of the listing.
Which LiteLLM versions are affected by CVE-2026-40217?
The GitHub advisory lists litellm versions 1.81.8 up to, but not including, 1.83.10 as affected. Its patch note says the fix ships in 1.83.11, while the metadata lists 1.83.10. Upgrading to 1.83.11 or later avoids the ambiguity.
Does an attacker need a login to exploit CVE-2026-40217?
In default configurations, yes. The advisory says reaching the vulnerable endpoint requires a proxy-admin credential. That sounds reassuring, but the proxy admin key is often shared in scripts and CI. A leaked admin key plus this bug gives code execution as root in the default Docker image.
How do I mitigate CVE-2026-40217 if I cannot upgrade LiteLLM today?
Block POST requests to /guardrails/test_custom_code at your reverse proxy or API gateway, as the advisory recommends. Then rotate the proxy master key and any provider API keys the proxy holds if you find calls to that endpoint you cannot explain. Upgrade as soon as you can.
Conclusion
This LiteLLM CVE is an old bug with a new label: exploited. If you run a LiteLLM proxy, check the version today, upgrade to 1.83.11+, and block the test endpoint at the edge. Then review who holds the master key. If this helped, share it with whoever owns your AI gateway, and follow NexGismo for more security updates explained for developers.
Sources
- GitHub — BerriAI/litellm advisory GHSA-wxxx-gvqv-xp7p
- CISA — CISA Adds Four Known Exploited Vulnerabilities to Catalog (Nov 18, 2026)
- CISA — Known Exploited Vulnerabilities Catalog
- LiteLLM docs — Custom Code Guardrail
- Ostorlab — LiteLLM guardrail sandbox escape RCE (CVE-2026-40217)
- SecurityOnline — CISA adds 4 exploited flaws to KEV
- Cybersecurity News — CISA warns of four actively exploited flaws