CVE-2026-40217: Litellm LiteLLM Has A Sandbox Escape Vulnerability
HIGHCVE-2026-40217 is a HIGH (CVSS 8.8) litellm has a sandbox escape vulnerability (CWE-913: Improper Control of Dynamically-Managed Code Resources) affecting Litellm libraries in the PyPI ecosystem. The issue involves litellm has a sandbox escape in custom-code guardrail. Remediation is available by upgrading affected packages to version 1.83.10.
CVE-2026-40217 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-40217
To remediate this vulnerability, upgrade all affected Litellm dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install litellm>=1.83.10
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show litellm
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-40217, inspect your installed packages using pip:
pip show litellm
Analyze the terminal output to locate any version of Litellm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.83.10), your application is affected.
Note: The pip show litellm command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-913: Improper Control of Dynamically-Managed Code Resources, where the product does not properly restrict reading from or writing to dynamically-managed code resources such as variables, objects, classes, attributes, functions, or executable instructions or statements. In Litellm, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-40217 Affected Litellm Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
litellm
|
PyPI |
≥ 1.81.8
< 1.83.10
|
1.83.10
|
References
Frequently Asked Questions
What is CVE-2026-40217?
Which Litellm versions are affected?
What version fixes CVE-2026-40217?
Is litellm affected?
What is the CVSS score of CVE-2026-40217?
What CWE is associated with CVE-2026-40217?
How can I check PyPI dependencies for CVE-2026-40217?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wxxx-gvqv-xp7p",
"modified" : "2026-05-11T16:17:23Z",
"published" : "2026-05-11T16:17:23Z",
"aliases" : [ "CVE-2026-40217" ],
"summary" : "LiteLLM has a sandbox escape in custom-code guardrail",
"details" : "### Impact\n\nThe `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.\n\n**Reaching the endpoint requires a proxy-admin credential** in default configurations.\n\n### Patches\n\nFixed in **`1.83.11`**. The hand-rolled sandbox has been replaced with `RestrictedPython`. Upgrade to `1.83.11` or later.\n\n### Workarounds\n\nIf upgrading is not immediately possible, block `POST /guardrails/test_custom_code` at your reverse proxy or API gateway.\n\n### References\n\n- Patched release: [`v1.83.10-stable`](https://github.com/BerriAI/litellm/releases/tag/v1.83.10-stable)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "litellm"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.81.8"
}, {
"fixed" : "1.83.10"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/BerriAI/litellm/security/advisories/GHSA-wxxx-gvqv-xp7p"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40217"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/BerriAI/litellm"
}, {
"type" : "WEB",
"url" : "https://github.com/BerriAI/litellm/releases/tag/v1.83.10-stable"
}, {
"type" : "WEB",
"url" : "https://www.x41-dsec.de/lab/advisories/x41-2026-001-litellm"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-420", "CWE-913" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-11T16:17:23Z",
"nvd_published_at" : null
}
}