HIGHvulnerability·

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.

This report was researched and drafted by an AI agent and reviewed by a human analyst prior to publication. View the agent workflow →
Indicators of Compromise(3)
↓ Download STIX
Domainjet-night.com
Domainnewapi.pro
SHA256bb0639701796218a3447160e55c0f1097446e4e6085df7dfd39f476d4143743f

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 litellm through version 2026-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_code URI, 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_code URI.
  • Process Monitoring: Look for unusual child processes spawned by the litellm application or its parent process, especially cmd.exe, powershell.exe, sh, or other scripting interpreters.
  • File System Monitoring: Monitor for suspicious file writes or modifications within the litellm application’s directories, particularly for new executables or scripts.
  • Network Traffic: Analyze network traffic originating from the litellm host for outbound connections to unusual destinations or command-and-control (C2) infrastructure.

Sigma Detection Rules

⚠️ AI-generated detection rules. These are experimental starting points. Review field names, EventIDs, and logic against your environment’s schema before deploying. Tune to reduce false positives.

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

  1. Patch Immediately: Upgrade BerriAI LiteLLM to a version beyond 2026-04-08 that contains the fix. Refer to vendor advisories for specific patch versions.
  2. Network Segmentation: Isolate LiteLLM instances on a dedicated network segment with strict egress filtering to limit potential lateral movement or C2 communication.
  3. Access Control: Restrict network access to the LiteLLM service and specifically the /guardrails/test_custom_code endpoint to only trusted internal sources or necessary administrative interfaces.
  4. Least Privilege: Run the LiteLLM application with the minimum necessary user privileges to limit the impact of successful exploitation.
  5. 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 Interpreter
  • T1078 — Valid Accounts
  • T1078.004 — Cloud Accounts
  • T1496 — Resource Hijacking
  • T1090 — Proxy
  • T1136.003 — Cloud Account
  • T1098.001 — Additional Cloud Credentials
  • T1098 — Account Manipulation
  • T1537 — Transfer Data to Cloud Account
  • T1552.004 — Private Keys
  • T1548 — Abuse Elevation Control Mechanism
  • T1578.002 — Create Cloud Instance
  • T1087 — Account Discovery
  • T1550.001 — Application Access Token
  • T1190 — Exploit Public-Facing Application
  • T1213 — Data from Information Repositories
  • T1528 — Steal Application Access Token
  • T1578.004 — Revert Cloud Instance
  • T1539 — Steal Web Session Cookie
  • T1090.003 — Multi-hop Proxy
  • T1562.008 — Disable or Modify Cloud Logs
  • T1580 — Cloud Infrastructure Discovery
  • T1068 — Exploitation for Privilege Escalation
  • T1552.001 — Credentials In Files
🤖 AI Attribution
Generated by gemini-2.5-flash ·
2,415 input / 2,152 output tokens ·
Reviewed and approved by a human analyst before publication
#vulnerability#cloud#high#litellm#llmjacking#rce#vulnerability