Browse / AI Framework and Platform Flaws / CVE-2026-40217
LiteLLM has a sandbox escape in custom-code guardrail
- Class
- AI Framework and Platform Flaws (filed by a model that read the advisory)
- Technique
- Sandbox escape
- Affected
- litellm (PyPI)
- Gets past
- Sandbox or allowlist
- CVSS
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- EPSS
- 17.0% chance of exploitation in 30 days
How it works, in short
Bytecode-level techniques break out of the hand-rolled Python sandbox behind the custom guardrail test endpoint, running code in the proxy process. (Our summary, written by a model. The source text is below.)
Details
Impact
The POST /guardrails/test_custom_code endpoint runs user-supplied Python inside a hand-rolled sandbox. The sandbox can be escaped using bytecode-level techniques, allowing arbitrary code execution in the proxy process — which runs as root in the default Docker image.
Reaching the endpoint requires a proxy-admin credential in default configurations.
Patches
Fixed in 1.83.11. The hand-rolled sandbox has been replaced with RestrictedPython. Upgrade to 1.83.11 or later.
Workarounds
If upgrading is not immediately possible, block POST /guardrails/test_custom_code at your reverse proxy or API gateway.
References
- Patched release:
v1.83.10-stable
References
- https://github.com/BerriAI/litellm/security/advisories/GHSA-wxxx-gvqv-xp7p
- https://nvd.nist.gov/vuln/detail/CVE-2026-40217
- https://github.com/BerriAI/litellm
- https://github.com/BerriAI/litellm/releases/tag/v1.83.10-stable
- https://www.x41-dsec.de/lab/advisories/x41-2026-001-litellm
Source: GitHub Advisory Database, used under CC BY 4.0.