On November 18 CISA added BerriAI LiteLLM flaw CVE-2026-40217 to its Known Exploited Vulnerabilities catalog; remote attackers can execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code endpoint, with a federal deadline of December 2 [1]. BerriAI's GitHub advisory says the endpoint runs user-supplied Python in a hand-rolled sandbox that can be escaped to run arbitrary code in the proxy process, which runs as root in the default Docker image; X41 D-Sec published on April 8 when no vendor patch was available [2][3]. What to do now: upgrade LiteLLM to 1.83.11 or later per BerriAI, or block POST /guardrails/test_custom_code at the reverse proxy or API gateway if you cannot upgrade yet [2].
LiteLLM guardrail test endpoint sandbox escape CVE-2026-40217 exploited, added to CISA KEV
2 min readLast updated
30-second summary
What happened
Who is affected
Organisations running: BerriAI LiteLLM
What to do nowOur advice
- Upgrade LiteLLM to 1.83.11 or later [2].
- If you cannot upgrade immediately, block POST /guardrails/test_custom_code at your reverse proxy or API gateway .
- Disclosed
- Apr 8, 2026
- Published
- Nov 20, 2026
- Last updated
- Nov 19, 2026
- CVSS basis
- Our assessment
- 20.2%, higher than 98% of CVEs
- Technology
- Attack vector
- Impact
- Vulnerability status
- Actor type
- Motivation
On this page
Affected scope
Do you run this product?
Add it to your systems list and we'll email you about related advisories and major updates.
Timeline
Technical details
What Happened
On November 18, 2026, CISA added CVE-2026-40217 to its catalog, describing it as an unprotected alternate channel vulnerability in BerriAI LiteLLM, where remote attackers can execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI [1]. CISA's remediation deadline for federal agencies is December 2, and whether it has been used in attacks is listed as unknown [1]. Current sources do not specify the targets, timing, or identity of the threat actors.
Vulnerability Background
BerriAI's GitHub security advisory explains that the POST /guardrails/test_custom_code endpoint executes user-supplied Python within a hand-rolled sandbox. This sandbox can be escaped using bytecode-level techniques to execute arbitrary code within the proxy process, which runs as root in the default Docker image. Under default settings, accessing this endpoint requires proxy administrator credentials [2]. Finder X41 D-Sec noted that the endpoint filtered source code using regular expressions only, which could be bypassed using string concatenation and CPython bytecode manipulation. X41 discovered the issue on February 13 and disclosed it on April 8 after the vendor embargo expired, at which point no vendor was available [3].
Affected and Patched Versions
BerriAI's advisory lists affected versions as 1.81.8 and later, prior to 1.83.10, with the patched version listed as 1.83.10 and above. The text specifies that it was fixed in 1.83.11, the custom sandbox was replaced with RestrictedPython, and upgrading to 1.83.11 or later is recommended [2].
Remediation
References
Official / primary2
- [1]
“BerriAI LiteLLM contains an unprotected alternate channel vulnerability that could allow remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI.”
- [2]
Found this useful?
Pass it to whoever runs these systems so they can patch in time.
This site aggregates public information and is not security consulting advice. Test remediation steps before applying.