CISA added CVE-2026-40217 to its exploited-vulnerabilities catalog on November 18. The flaw is in LiteLLM’s custom-code guardrail test: bytecode rewriting lets an attacker escape its Python sandbox and execute code in the AI gateway’s proxy process. Operators running LiteLLM proxies now have a specific route and installed version to check.

The CVE record dates publication to April 10; the new development is CISA’s exploitation listing. BerriAI’s advisory specifies the default access condition: “Reaching the endpoint requires a proxy-admin credential in default configurations.” Check whether the test route requires proxy-admin authentication in your deployment before assessing an externally reachable proxy. A stolen admin credential or a deployment with different access controls changes the exposure decision.

The guardrail test escapes its sandbox

The endpoint, POST /guardrails/test_custom_code, accepts Python for a custom-code guardrail test. BerriAI says its hand-rolled sandbox can be escaped through bytecode-level techniques, after which the code runs in the LiteLLM proxy process. In the default Docker image, that process runs as root. The proxy-admin credential gates the test route, while the sandbox is supposed to confine code submitted through it. An admin credential alone cannot contain code that has escaped the sandbox.

CVE’s published record also describes bytecode rewriting at the same URI. CISA labels the issue an “unprotected alternate channel”; the vendor calls it a sandbox escape and describes the default admin requirement.

Check access before upgrading

Find LiteLLM proxy deployments, record the installed package version and the image in use, and review whether the route is reachable through your reverse proxy or API gateway. Inspect request logs for POST to /guardrails/test_custom_code and correlate any matches with proxy-admin authentication records. Preserve the relevant gateway, application and process logs if a request or credential use is unexpected; examine proxy-host process activity in the same window.

The vendor lists affected pip versions as >=1.81.8, <1.83.10 and labels >=1.83.10 patched, but its patch text explicitly says the fix is in 1.83.11 and directs users to upgrade to 1.83.11 or later. Use 1.83.11 or later as the vendor’s stated upgrade target and verify the installed version of the running proxy, including container images. BerriAI says that release replaces the hand-rolled sandbox with RestrictedPython.

If the upgrade must wait, block POST /guardrails/test_custom_code at the reverse proxy or API gateway as BerriAI instructs. Test the rule from a client that previously had access: the edge must deny that method and path while normal proxy traffic still works. Check the application deployment as well, since a second ingress that bypasses that edge would preserve access to the test route.

Restrict the test route now

CISA gives December 2 as the KEV action date and calls for vendor-directed mitigation, internet-exposure assessment and applicable federal patch guidance. The vendor’s default proxy-admin requirement makes credential access part of that assessment. Restrict the code-test route while moving affected running proxies to 1.83.11 or later; then confirm the installed version and repeat the edge access test. Forensic review of unexpected admin use and code-test requests remains separate from patch verification.