CVE-2026-40217: BerriAI LiteLLM Remote Code Execution via Unprotected Channel
CVE-2026-40217 is a high-severity remote code execution vulnerability in BerriAI LiteLLM through version 2026-04-08. Exploitation occurs via bytecode rewriting at the `/guardrails/test_custom_code` URI, allowing remote attackers to execute arbitrary code. This vulnerability is actively exploited, often associated with “LLMjacking” attacks to monetize compromised cloud and model resources.
| Domain | jet-night.com |
| Domain | newapi.pro |
| SHA256 | bb0639701796218a3447160e55c0f1097446e4e6085df7dfd39f476d4143743f |
Overview
CVE-2026-40217 is a critical remote code execution (RCE) vulnerability affecting BerriAI LiteLLM versions up to and including 2026-04-08. This flaw allows remote attackers to execute arbitrary code by manipulating bytecode through an unprotected alternate channel at the /guardrails/test_custom_code URI. The vulnerability has been actively exploited in the wild, with observed attacks leveraging it for “LLMjacking” and unauthorized access to cloud and AI model resources.
Technical Analysis
- Vulnerability: Unprotected Alternate Channel (CWE-420) and Code Injection (CWE-94) leading to Remote Code Execution.
- Affected Products:
litellm litellmthrough version2026-04-08. - Attack Vector: Network (CVSS AV:N). Exploitation is possible remotely without user interaction (UI:N) and requires low privileges (PR:L). The CVSS 3.1 score is 8.8 (HIGH).
- Exploitation Method: Attackers can execute arbitrary code by sending crafted requests to the
/guardrails/test_custom_codeURI, leveraging bytecode rewriting capabilities. - Impact: High impact on confidentiality, integrity, and availability (C:H/I:H/A:H) due to arbitrary code execution.
Detection
- Web Server Logs: Monitor web server access logs for requests targeting the
/guardrails/test_custom_codeURI. - Process Monitoring: Look for unusual child processes spawned by the
litellmapplication or its parent process, especiallycmd.exe,powershell.exe,sh, or other scripting interpreters. - File System Monitoring: Monitor for suspicious file writes or modifications within the
litellmapplication’s directories, particularly for new executables or scripts. - Network Traffic: Analyze network traffic originating from the
litellmhost for outbound connections to unusual destinations or command-and-control (C2) infrastructure.
Sigma Detection Rules
LiteLLM Unprotected Channel URI Access
title: LiteLLM Unprotected Channel URI Access
id: 8d7e9f1a-2b3c-4d5e-6f7a-8b9c0d1e2f3a
status: experimental
description: Detects access attempts to the vulnerable /guardrails/test_custom_code URI in BerriAI LiteLLM, indicative of potential exploitation of CVE-2026-40217.
logsource:
category: webserver
detection:
selection:
cs-uri-stem|endswith: '/guardrails/test_custom_code'
condition: selection
level: high
LiteLLM Child Process Spawn (Windows)
title: LiteLLM Child Process Spawn (Windows)
id: a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects suspicious child processes spawned by the LiteLLM application, potentially indicating successful exploitation of CVE-2026-40217 leading to arbitrary code execution.
logsource:
product: windows
service: sysmon
detection:
selection_parent:
ParentImage|endswith: '\\litellm.exe'
selection_child_process:
Image|endswith:
- '\\cmd.exe'
- '\\powershell.exe'
- '\\pwsh.exe'
- '\\wscript.exe'
- '\\cscript.exe'
- '\\bash.exe'
- '\\sh.exe'
condition: selection_parent and selection_child_process
level: critical
LiteLLM Child Process Spawn (Linux)
title: LiteLLM Child Process Spawn (Linux)
id: b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e
status: experimental
description: Detects suspicious child processes spawned by the LiteLLM application on Linux, potentially indicating successful exploitation of CVE-2026-40217 leading to arbitrary code execution.
logsource:
product: linux
service: auditd
detection:
selection_parent:
- a0: 'litellm'
- comm: 'litellm'
selection_child_process:
- a0:
- 'sh'
- 'bash'
- 'dash'
- 'python'
- 'perl'
- 'php'
- 'wget'
- 'curl'
- 'nc'
- 'ncat'
- comm:
- 'sh'
- 'bash'
- 'dash'
- 'python'
- 'perl'
- 'php'
- 'wget'
- 'curl'
- 'nc'
- 'ncat'
condition: selection_parent and selection_child_process
level: critical
Mitigations
- Patch Immediately: Upgrade BerriAI LiteLLM to a version beyond
2026-04-08that contains the fix. Refer to vendor advisories for specific patch versions. - Network Segmentation: Isolate LiteLLM instances on a dedicated network segment with strict egress filtering to limit potential lateral movement or C2 communication.
- Access Control: Restrict network access to the LiteLLM service and specifically the
/guardrails/test_custom_codeendpoint to only trusted internal sources or necessary administrative interfaces. - Least Privilege: Run the LiteLLM application with the minimum necessary user privileges to limit the impact of successful exploitation.
- Input Validation: Implement robust input validation at the web application firewall (WAF) or API gateway level to filter out malicious requests targeting the vulnerable endpoint.
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-40217
- https://www.x41-dsec.de/lab/advisories/x41-2026-001-litellm/
- https://access.redhat.com/errata/RHSA-2026:24866
- https://access.redhat.com/errata/RHSA-2026:30056
- https://access.redhat.com/security/cve/CVE-2026-40217
- https://bugzilla.redhat.com/show_bug.cgi?id=2457301
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40217.json
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-40217
- https://cloud.google.com/blog/topics/threat-intelligence/llmjacking-monetizing-compromised-cloud-models/
- https://www.bleepingcomputer.com/news/security/google-llmjacking-attacks-rack-up-1-million-in-cloud-ai-charges/
- https://thehackernews.com/2026/09/nearly-1-in-10-exposed-litellm-gateways.html
- https://thehackernews.com/2026/06/litellm-flaw-cve-2026-42271-exploited.html
- https://github.com/BerriAI/litellm/security/advisories/GHSA-7488-6r32-c95q
Indicators of Compromise
| Type | Value | Description |
|---|---|---|
| SHA256 | bb0639701796218a3447160e55c0f1097446e4e6085df7dfd39f476d4143743f |
SHA256 hash of the confirmed affected LiteLLM Docker image (via https://www.x41-dsec.de/lab/advisories/x41-2026-001-litellm/) |
| Domain | jet-night.com |
Malicious token routing service (via https://cloud.google.com/blog/ko/topics/threat-intelligence/llmjacking-monetizing-compromised-cloud-models?hl=ko) |
| Domain | newapi.pro |
Illegal LLM access resale ecosystem (via https://cloud.google.com/blog/ko/topics/threat-intelligence/llmjacking-monetizing-compromised-cloud-models?hl=ko) |
MITRE ATT&CK
T1059— Command and Scripting InterpreterT1078— Valid AccountsT1078.004— Cloud AccountsT1496— Resource HijackingT1090— ProxyT1136.003— Cloud AccountT1098.001— Additional Cloud CredentialsT1098— Account ManipulationT1537— Transfer Data to Cloud AccountT1552.004— Private KeysT1548— Abuse Elevation Control MechanismT1578.002— Create Cloud InstanceT1087— Account DiscoveryT1550.001— Application Access TokenT1190— Exploit Public-Facing ApplicationT1213— Data from Information RepositoriesT1528— Steal Application Access TokenT1578.004— Revert Cloud InstanceT1539— Steal Web Session CookieT1090.003— Multi-hop ProxyT1562.008— Disable or Modify Cloud LogsT1580— Cloud Infrastructure DiscoveryT1068— Exploitation for Privilege EscalationT1552.001— Credentials In Files
Generated by
gemini-2.5-flash ·2,415 input / 2,152 output tokens ·
Reviewed and approved by a human analyst before publication