Tia N.List

KEV catalog · CISA Known Exploited Vulnerabilities

CVE-2026-40217 8.8
BerriAI · LiteLLM · Added 2026-11-18 · Published 2026-04-10
3-Day Required PoC Available KEV Active Exploitation

Details

VulnerabilityBerriAI LiteLLM Unprotected Alternate Channel Vulnerability
VendorBerriAI
ProductLiteLLM
Date added2026-11-18
Due date2026-12-02
Required actionApply mitigations in accordance with vendor instructions, ensuring compliance with CISA’s BOD 26-04 Prioritizing Security Updates Based on Risk (see URL in Notes) guidance and CISA’s “Forensics Triage Requirements” (see URL in Notes). Follow applicable BOD 26-04 guidance for cloud services or discontinue use of the product if mitigations are unavailable. Stakeholders are responsible for evaluating each asset's internet exposure and ensuring adherence to BOD 26-04 patching guidelines.
CWECWE-420 CWE-94
CVSS vectorCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS 0.2021 · 98th percentile · 2026-11-26 · 7d -0.4170
EPSS trend 0.1700 → 0.2020 +0.0320 over 21 observations
Descriptions

KEV: BerriAI LiteLLM contains an unprotected alternate channel vulnerability that could allow remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI.

NVD: LiteLLM through 2026-04-08 allows remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI.

Compliance SSVC + BOD 26-04

Automatableno
Technical impacttotal
Exploitation statusactive
3-day qualifyingYes
Public timeline3 days + forensic
Non-public timeline14 days
Forensic (public)Required
Forensic (non-public)Not required

Research metadata

Last researched2026-11-18 22:11 UTC
Wall time0.7s
Searches1
Component defaultyes

Hunting hypothesis agent

Hunt WAF or body-capturing proxy logs for POST /guardrails/test_custom_code with custom_code carrying string-fragment dunders ("_"+"_gl"+"ob"+"als"), str.mro()[1], gi_code or co_names, behind Bearer sk- key spray; 200s echo rce output.

Research details

ComponentCustom-code guardrail sandbox (test_custom_code_guardrail handler in litellm/proxy/guardrails/guardrail_endpoints.py + CustomCodeGuardrail compile)
Preconditionslitellm (PyPI) 1.81.8 through 1.83.9; fixed in 1.83.10/1.83.11. Network reach to the proxy listener (default :4000) plus a valid 'Authorization: Bearer sk-...' credential - the master key or any proxy_admin key, since 1.82.0 enforces PROXY_ADMIN on the compile endpoints. The default Docker image runs the proxy as root; no user interaction or special config needed. agent
DeliveryAuthenticated HTTP POST to the LiteLLM proxy admin API (/guardrails/test_custom_code) with the exploit Python in the custom_code JSON field
Public PoCyes
Exploit notesWeaponized: X41's advisory, a runnable PoC repo (docker-compose + exploit/exploit.py) and a verified Nuclei template all ship the same single authenticated POST with a ~6-line Python bytecode-rewrite payload - no offsets, memory corruption or race to win. Requires the admin/master key, which real-world traffic obtained by spraying documented defaults (sk-1234, sk-litellm-master-key, sk-admin, sk-changeme). Captured payloads spawn detached subprocess.Popen(..., shell=True) to outlive the endpoint's 5s execution budget.
Operational notescaused-by-fix: 1.83.10+ replaces the regex deny-list with RestrictedPython and curated primitives, so environments whose custom_code guardrails use import/exec/eval, class definitions or raw dunder access stop compiling and the guardrail fails to load - rewrite those guardrails against regex_match/json_parse/http_get before upgrading. caused-by-fix: the same releases enforce PROXY_ADMIN on guardrail compile endpoints, so non-admin virtual keys that previously posted to /guardrails or /guardrails/test_custom_code now get 403 and automation built on them breaks. agent
https://docs.litellm.ai/docs/proxy/guardrails/custom_code_guardrail
https://github.com/BerriAI/litellm/pull/25818
https://github.com/BerriAI/litellm/releases/tag/v1.83.10-stable
https://www.obsidiansecurity.com/blog/litellm-privilege-escalation-rce
SummaryCVE-2026-40217 is a sandbox escape in LiteLLM's custom-code guardrail: the /guardrails/test_custom_code tester runs admin-supplied Python through a regex deny-list, and CPython bytecode rewriting (gi_code/co_names with object.__setattr__) recovers the real __import__ for arbitrary command execution in the proxy process, root in the default Docker image. Affected versions are litellm 1.81.8 through 1.83.9; 1.83.10/1.83.11 replace the hand-rolled sandbox with RestrictedPython. Exploitation needs a master or proxy_admin key, and observed attack traffic paired the payload with sprays of documented default master keys.

Tia coverage

First reported2026-09-07
First exploit report2026-11-18
Exploit report → KEV0 days before the listing

When Tia's reporting first covered this CVE and whether a report claimed exploitation before the KEV listing. Lead-time deltas are measured from the exploitation report only — plain coverage is not exploitation intel. See the story links under Mentioned in for coverage detail.

Mentioned in

able2shell-frequently-asked-questions-for-reported-n-able-n-centcisa-warns-of-4-exploited-flaws-linked-to-ransomware-cryptomininlitellm-and-langflow-rces-under-active-exploitation-cisa-kev

Record schema v1.0. Enrichment is research-grade, not a substitute for analyst review.

Source on GitHub