INCIDENT MAP

Browse / AI Framework and Platform Flaws / CVE-2026-40217

LiteLLM has a sandbox escape in custom-code guardrail

CVE-2026-40217 · 2026-05-11 high

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

References

Source: GitHub Advisory Database, used under CC BY 4.0.