Threat feed

CVE-2026-40217 — LiteLLM custom-code guardrail sandbox escape lets code run on the proxy, exploited in the wild: explainer and fix (listed in KEV, due 2 December)

CVE-2026-40217: a sandbox escape at /guardrails/test_custom_code in the LiteLLM proxy (CVSS 8.8). In KEV since 18 November. Fixed in 1.83.11 and later.

Published 2026-11-19 Updated 2026-11-19 Last verified 2026-11-19 6 min read
On this page

For: development and platform teams that run a LiteLLM proxy (AI gateway), and IT teams that look after in-house AI infrastructure. This article is based on BerriAI's advisory, the CVE record and CISA KEV; it does not cover attack steps.

続報待ち:この記事は公式発表に合わせて更新します

Who is affected

development and platform teams that run a LiteLLM proxy (AI gateway), and IT teams that look after in-house AI infrastructure.

Confirmed so farSee the table ↓
  • The flaw
  • Affected and fixed versions
  • Exploitation
Not yet confirmed
  • How the attacks work and how far they reached (CISA shows exploitation via KEV and SSVC; no detail in official sources)
  • Whether authentication is required (BerriAI says an admin credential is needed; the KEV text does not mention it)
  • The inconsistent fixed-version number inside BerriAI's advisory (1.83.10 or 1.83.11; this site recommends 1.83.11 or later)
What to do nowSee the steps ↓
  1. Check your LiteLLM version and whether you run the proxy
  2. Update to 1.83.11 or later (avoid 1.107.0)
  3. Block the endpoint upstream if you cannot update
2 more
  1. Narrow admin keys and check they have not leaked
  2. Look for signs of compromise
Where to verify (source)All sources ↓
BerriAI
Last checked
as of November 19, 2026
Follow-up plans and what we checked

CISA added the flaw to KEV on November 18; its SSVC entry lists Exploitation as active, Automatable no and Technical Impact total. The KEV description does not address whether authentication is required. BerriAI's advisory says an admin credential is needed.

What to do today

1

Check your LiteLLM version and whether you run the proxy

Using LiteLLM only as a library is different from running the proxy (server). This flaw concerns POST /guardrails/test_custom_code on the proxy. If the proxy is 1.81.8 up to but not including 1.83.10 (the advisory's affected range), it is affected. List Docker tags, pip versions and proxies other teams set up for testing (asset inventory checklist).

2

Update to 1.83.11 or later (avoid 1.107.0)

BerriAI's advisory says it is fixed in 1.83.11 and to upgrade to 1.83.11 or later. Because the advisory disagrees with itself between 1.83.10 and 1.83.11, align on 1.83.11 or later. However, 1.107.0, distributed on October 21, contained malware. Confirm in the official announcement that your target version is safe before choosing it (the LiteLLM 1.107.0 incident).

3

Block the endpoint upstream if you cannot update

The advisory's workaround is to block POST /guardrails/test_custom_code at your reverse proxy or API gateway. Also confirm the proxy itself is not exposed to the internet.

4

Narrow admin keys and check they have not leaked

The advisory says reaching the endpoint needs a proxy-admin credential in default configurations. Check that the admin key does not sit in shared chat, code or logs, and rotate it if in doubt (environment variables and API key basics).

5

Look for signs of compromise

In proxy access logs, look for calls to /guardrails/test_custom_code from unfamiliar times or sources. Also check child processes of the proxy and unfamiliar outbound connections. Per the advisory the proxy runs as root in the default Docker image, so if anything looks wrong, rotate every LLM provider key the proxy stores and review usage history at each provider (how to check for intrusion).

What kind of flaw this is

Advisory summary — ADVISORY / KEV
CVE
CVE-2026-40217 (LiteLLM proxy: sandbox escape in the custom-code guardrail)
Severity
CVSS v3.1 8.8 (High; AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)
Type
Unprotected alternate channel (CWE-420) per KEV and the advisory; the advisory also lists improper control of dynamically-managed code resources (CWE-913)
Impact
Arbitrary code runs in the proxy process; root in the default Docker image (BerriAI)
Precondition
In default configurations a proxy-admin credential is needed to reach the endpoint (BerriAI)
Affected
1.81.8 up to but not including 1.83.10 (BerriAI advisory). The CVE record says LiteLLM through 2026-04-08
Fix
1.83.11 or later (sandbox replaced with RestrictedPython); the advisory is inconsistent with 1.83.10
Dates
CVE published April 10, 2026; GitHub advisory May 11; added to KEV November 18 (due December 2)
8.8
CVSS v3.1 (CVE record, NVD)
Dec 2
KEV due date
1.83.11
Fixed version per advisory (or later)
root
Privilege in the default Docker image (BerriAI)
  • In short: a feature for testing guardrails runs user-written Python inside a hand-rolled sandbox, and that fence breaks under low-level handling of code. Neither the official sources nor this site give the method.
  • The discoverer, a security firm, says it identified the issue on February 13, 2026 and published on April 8 (referenced by the CVE record). It notes no fix was available at publication.

What is known and what is not

ItemContentStatus
The flawSandbox escape in the custom-code guardrailConfirmed (BerriAI)
Affected and fixed versions1.81.8 to before 1.83.10; upgrade to 1.83.11 or laterConfirmed (BerriAI; fixed-version number inconsistent in the advisory)
AuthenticationAdmin credential needed (advisory); KEV does not mention itUnder investigation
ExploitationAdded to KEV; SSVC exploitation activeExploitation confirmed (CISA)
Attack method and victimsNot in official sourcesNot stated

Sources

No attack steps are included. Last verified: November 19, 2026.

Update history

2026-11-19: First report. Based on BerriAI's advisory, the CVE record and CISA KEV; the authentication question and the fixed-version inconsistency are listed as unconfirmed.

Latest breaking reports

All breaking reports →

FAQ

QWhat is CVE-2026-40217?
A

A flaw where POST /guardrails/test_custom_code in the LiteLLM proxy runs user-supplied Python in a hand-rolled sandbox that can be escaped using bytecode-level techniques. After the escape, arbitrary code runs in the proxy process, which BerriAI says runs as root in the default Docker image. CVSS v3.1 in the CVE record is 8.8.

QCan it be attacked without authentication?
A

BerriAI's advisory says reaching the endpoint requires a proxy-admin credential in default configurations. CISA's KEV text only says remote attackers can execute code and does not address authentication. The CVE record's CVSS also assumes low privileges (PR:L). This site treats environments with leaked admin keys or an internet-exposed admin API as the highest risk.

QWhich versions are affected and what is the fix?
A

BerriAI's advisory (GHSA-wxxx-gvqv-xp7p) lists 1.81.8 up to but not including 1.83.10 as affected and says it is fixed in 1.83.11; upgrade to 1.83.11 or later. The advisory is internally inconsistent about the first fixed release (1.83.10 versus 1.83.11), so aim for 1.83.11 or later. The CVE record says LiteLLM through 2026-04-08 rather than giving version numbers.

QIs there a workaround?
A

Yes. The advisory says to block POST /guardrails/test_custom_code at your reverse proxy or API gateway if you cannot upgrade right away. This closes that entry point but is no substitute for the fix.

QIs this the same as the October LiteLLM 1.107.0 incident?
A

No. The October 21 incident, where 1.107.0 shipped malware, was tampering with the distributed package (a supply chain compromise). This is a product vulnerability. One caution: when upgrading to 1.83.11 or later, do not pick the malicious 1.107.0. See our separate article.