CVE-2026-40217

8.8

BerriAI · LiteLLM

LiteLLM contains a vulnerability in the /guardrails/test_custom_code URI that allows authenticated remote attackers to execute arbitrary code via bytecode rewriting.

Executive summary

A critical remote code execution vulnerability in BerriAI LiteLLM allows authenticated attackers to compromise the host system through malicious bytecode manipulation.

Vulnerability

This issue is a code execution flaw triggered via the /guardrails/test_custom_code endpoint, where insufficient validation of provided code leads to dangerous bytecode rewriting. The CVSS vector indicates that while the attack is network exploitable, it requires low privileges (authenticated).

Business impact

The ability for an attacker to execute arbitrary code on a server hosting LiteLLM poses a catastrophic risk to organizational security. Successful exploitation could lead to full system compromise, exfiltration of sensitive configuration data, and the potential lateral movement of an attacker into the internal network. Given the CVSS score of 8.8, this vulnerability is classified as High severity and requires immediate attention to prevent unauthorized access and potential data loss.

Remediation

Immediate Action: Restrict access to the /guardrails/test_custom_code URI at the network or application level until a vendor-supplied security patch is released and applied.

Proactive Monitoring: Review application access logs for any suspicious POST requests directed at the /guardrails/test_custom_code endpoint, specifically looking for anomalous payloads.

Compensating Controls: Deploy a Web Application Firewall (WAF) rule to inspect and block requests containing suspicious code patterns or bytecode manipulation attempts targeting the vulnerable endpoint.

Exploitation status

Public Exploit Available: Yes — a public proof-of-concept exists on GitHub.

Analyst recommendation

The risk posed by CVE-2026-40217 is significant due to the potential for complete system takeover. Administrators should prioritize isolating the affected LiteLLM instance from untrusted network segments and implement strict access controls to ensure only authorized users can interact with the guardrails module. Once the vendor releases a patch, it should be tested and deployed in the environment as a matter of urgency.

More BerriAI CVEs

Sources