CVE-2026-40217

LiteLLM: LiteLLM: Arbitrary Code Execution via bytecode rewriting

Published Apr 10, 2026 CVSS 3.1 · 8.8 High EPSS 17.0% KEV · Not listed
Description
LiteLLM through 2026-04-08 allows remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI.

Analysis

AI-generated

Technical impact

LiteLLM implementations prior to April 8 2026 contain a flaw that allows attackers to inject and execute arbitrary bytecode through the /guardrails/test_custom_code endpoint. The vulnerability stems from unsafe bytecode rewriting, a form of code injection (CWE‑94) coupled with improper access controls that bypass authentication (CWE‑420), enabling the execution of arbitrary code on the host system. The impact is a full compromise of confidentiality, integrity and availability on the compromised machine.

Affected Systems

The issue affects BerriAI’s LiteLLM product. All versions of LiteLLM released on or before April 8 2026 are impacted. Precise version numbers are not listed, so any installation derived from the affected code base should be assumed vulnerable.

Risk and Exploitability

The CVSS score of 8.8 indicates high severity, while an EPSS score of 17% indicates a moderate‑to‑high likelihood of exploitation. The vulnerability is not currently flagged in the CISA KEV catalog. Based on the description, it is inferred that a remote HTTP request to the /guardrails/test_custom_code URI could be used as the attack vector, requiring network reachability to the service. If the endpoint is publicly reachable, an attacker can exploit this flaw without user interaction. The absence of additional mitigations in the cited advisory indicates the flaw can be fully leveraged once the endpoint is reachable.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Patch LiteLLM to the latest release that fixes the unsafe bytecode rewriting vulnerability, addressing both CWE-420 and CWE-94.
  • Restrict or disable the /guardrails/test_custom_code endpoint to trusted users only, enforcing strong authentication to prevent logical or access bypass (CWE-420).
  • Apply input validation and sanitization to all custom code submissions to block code injection and arbitrary code execution (CWE-94).
  • Block external network traffic to the vulnerable endpoint until the update is applied to reduce exposure risk.

Generated by OpenCVE AI on November 4, 2026 at 15:13 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-wxxx-gvqv-xp7p LiteLLM has a sandbox escape in custom-code guardrail
History
Type Values Removed Values Added
First Time appeared Litellm
Litellm litellm
CPEs cpe:2.3:a:litellm:litellm:*:*:*:*:*:*:*:*
Vendors & Products Litellm
Litellm litellm
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Title Remote Code Execution via Bytecode Rewriting on /guardrails/test_custom_code in LiteLLM LiteLLM: LiteLLM: Arbitrary Code Execution via bytecode rewriting
Weaknesses CWE-94
References
Metrics threat_severity

None

threat_severity

Important

Type Values Removed Values Added
Title Remote Code Execution via Bytecode Rewriting on /guardrails/test_custom_code in LiteLLM
Type Values Removed Values Added
First Time appeared Berriai
Berriai litellm
Vendors & Products Berriai
Berriai litellm
Type Values Removed Values Added
Description LiteLLM through 2026-04-08 allows remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI.
Weaknesses CWE-420
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

Weaknesses
  • CWE-420

    Unprotected Alternate Channel

  • CWE-94

    Improper Control of Generation of Code ('Code Injection')

Sources

Status
PUBLISHED
Assigner
mitre
Published
Updated
Jul 15, 2026, 1:01 AM
Reserved
Apr 10, 2026, 1:43 PM
Status
Modified
Published
Apr 10, 2026, 2:16 PM
Modified
Oct 26, 2026, 9:10 PM
Severity
Important
Public date
Apr 10, 2026, 1:43 PM