CVE-2026-40217: Python Sandbox Escape in BerriAI LiteLLM Custom Guardrail Testing
- Vendors
- Red HatLitellm
CVE-2026-40217 is an unprotected alternate channel vulnerability in BerriAI LiteLLM's custom guardrail testing functionality. Attacker-supplied Python code can manipulate or rewrite bytecode to bypass the custom sandbox's validation and execute arbitrary code within the LiteLLM proxy process. The vulnerable functionality requires proxy-administrator credentials in default configurations; separate authorization weaknesses or insecure configurations can make it accessible to lower-privileged callers. Exploitation is confirmed in the wild, including in LLMjacking activity.
Impact, mitigation & remediation
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
Impact
What an attacker gets, and what they’ve been doing with it.
Successful exploitation compromises the confidentiality, integrity, and availability of resources accessible to the LiteLLM process. Execution can occur as root inside the default Docker container, but does not inherently establish escape to the container host. Attackers can potentially obtain provider API keys, proxy administrative credentials, database credentials, and other accessible secrets; alter gateway behavior; disrupt service; and abuse connected model services at the victim's expense. Stolen credentials can enable persistence and further access to connected infrastructure.
Mitigation
If you can’t patch tonight, do this now.
Until patching is complete, disable the custom-code guardrail tester or block access to POST /guardrails/test_custom_code at the reverse proxy, API gateway, or ingress layer. Restrict administrative and guardrail APIs to trusted networks and authorized administrators, and review which keys can access them. Investigate unexpected tester requests, child-process execution, outbound connections, administrative changes, and abnormal model usage or billing. Access restrictions do not remove an existing compromise.
Remediation
Patch, then assume compromise.
Upgrade to the latest supported, vendor-confirmed fixed LiteLLM release. Maintainer guidance identifies 1.83.11 or later as fixing this vulnerability, while some accounts identify 1.83.10 as the initial fix; verify the applicable advisory rather than relying on the earlier cutoff. The remediation replaces the custom sandbox with RestrictedPython. Address related authorization and credential-exposure vulnerabilities separately, since fixing this sandbox escape alone does not resolve the broader attack chain. Apply product-specific updates for bundled LiteLLM deployments. For potentially compromised instances, investigate before returning them to service and rotate LiteLLM master keys, upstream provider keys, database credentials, and other exposed secrets.
Exploits
3 exploits validated by Mallory's analysis.
Affected products & vendors
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
References
Frequently asked questions
- Is CVE-2026-40217 exploited in the wild?
- Yes. As of Nov 27, 2026, Mallory has reports of exploitation in the wild, and CISA added it to KEV on Nov 18, 2026.
- Is there a public exploit for CVE-2026-40217?
- Yes. Mallory tracks 3 public exploits or proofs of concept for CVE-2026-40217, the earliest disclosed May 19, 2026.
- Is there a patch for CVE-2026-40217?
- Upgrade to the latest supported, vendor-confirmed fixed LiteLLM release. Maintainer guidance identifies 1.83.11 or later as fixing this vulnerability, while some accounts identify 1.83.10 as the initial fix; verify the applicable advisory rather than relying on the earlier cutoff.
- What products are affected by CVE-2026-40217?
- Litellm, Red Hat Ansible Automation Platform, Red Hat Openshift Ai, and Red Hat Openshift Lightspeed.
- How severe is CVE-2026-40217?
- CVE-2026-40217 has a CVSS v3.1 score of 8.8 (High) and an EPSS score of 20.6% (98th percentile) as of Nov 27, 2026.
Recent activity
103 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.