LiteLLM RCE actively exploited

High 8.8 Actively exploited Litellm CVE-2026-40217

Actively exploited

Severity 8.8 Reach 10.0 Ease 8.0 Exploitation 10.0 Tooling 6.0

Risk assessment

LiteLLM through 2026-04-08 allows unauthenticated remote code execution via custom code guardrails (CVSS 8.8), actively exploited. Restrict /guardrails/test_custom_code now.

By Yazoul AI · automated

What to do

Apply the latest security patches from the vendor. If patching is not immediately possible, review the mitigation steps in this advisory and monitor for exploitation attempts.

Actively exploited in the wild - CVE-2026-40217 is a high-severity remote code execution vulnerability in LiteLLM through 2026-04-08 that lets a remote attacker run arbitrary code on the server by abusing bytecode rewriting at the /guardrails/test_custom_code endpoint. No vendor patch is documented as of this writing; restrict or disable that endpoint immediately.

Overview

LiteLLM is an open-source proxy and gateway that teams deploy in front of large language model providers to centralize API keys, routing, budgets, and usage tracking. Its guardrails feature lets administrators attach custom Python code that inspects or rewrites model traffic. The /guardrails/test_custom_code URI exists so operators can test that custom code before enabling it.

CVE-2026-40217 arises because that test endpoint processes attacker-supplied code through a bytecode rewriting step without adequate isolation. An attacker who can reach the endpoint can submit crafted input that gets compiled and executed on the LiteLLM host. The CVSS vector (AV:N/AC:L/PR:L/UI:N, 8.8) reflects network reachability, low complexity, and a low privilege requirement, with no user interaction needed. In practice, any foothold on the network path to the proxy, including a low-privileged API key or exposed admin surface, is enough to attempt exploitation.

Impact

Successful exploitation gives the attacker code execution in the context of the LiteLLM process. Because the proxy sits at the center of an organization’s LLM stack, that access is unusually valuable: the process holds upstream provider API keys and often database credentials for its backing store. An attacker can read those secrets, tamper with routing so responses are altered or logged, pivot to internal services reachable from the host, or use it as a launchpad for further intrusion. CISA has added this CVE to its Known Exploited Vulnerabilities catalog, and EPSS estimates a 17% probability of exploitation in the next 30 days, so the window for defensive action is short.

Remediation and Mitigation

  • Restrict the endpoint first. Block external access to /guardrails/test_custom_code at the reverse proxy or load balancer. If guardrail testing is not in active use, disable it entirely.
  • Upgrade when a fix lands. Track the LiteLLM project for a release past 2026-04-08 that addresses this CVE and apply it as soon as it is available.
  • Rotate secrets. Assume any exposed instance was compromised: rotate upstream LLM API keys, database credentials, and any tokens the proxy held.
  • Review logs. Search for requests to the guardrails test URI and for unexpected outbound connections from the LiteLLM host.
  • Harden the perimeter. Do not expose the proxy admin interface to the internet; require authentication and network-level allowlisting.

For related incident context, see our breach reports and security news.

Security Insight

LiteLLM is the latest example of the “test endpoint” problem: developer convenience routes ship with the same privileges as production paths, and they rarely receive the same scrutiny. A proxy that aggregates credentials across every model provider is a high-value target by design, so a code execution bug here is worth more than the CVSS score suggests. The rapid KEV listing signals attackers already treat LLM gateways as a viable entry point, and vendors building fast-moving AI tooling should assume their debug surfaces will be probed first.

Further Reading

Exploit references 1 PoC · 1 Nuclei Show

Public PoC References

Unverified third-party code

These repositories are publicly listed on GitHub and have not been audited by Yazoul Security. They may contain malware, backdoors, destructive payloads, or operational security risks (telemetry, exfiltration). Treat them as hostile binaries. Inspect source before execution. Run only in isolated, disposable lab environments (offline VM, no credentials, no production data).

Authorized use only. This information is provided for defensive research, detection engineering, and patch validation. Using exploit code against systems you do not own or do not have explicit written permission to test is illegal in most jurisdictions and violates Yazoul's terms of use.

Repository Stars
learner202649/CVE-2026-40217-PoC

The code for personally reproducing the corresponding vulnerability

★ 1

Showing 1 of 1 known references. Source: nomi-sec/PoC-in-GitHub.

Nuclei Detection Templates

Detection template available — your exposure is being scanned

The templates below are YAML signatures for the Nuclei scanner from ProjectDiscovery. They are not exploit code — they are detection rules that confirm whether a target is vulnerable. The presence of a Nuclei template means every bug bounty hunter, AppSec team, red team, and reconnaissance pipeline on the public internet is actively probing for this CVE.

Assume your exposed instances have already been touched. Patch immediately even if no exploitation is observed yet — fingerprinting precedes exploitation by days at most.

Template Source
CVE-2026-40217.yaml View YAML

1 Nuclei template indexed for this CVE. Source: projectdiscovery/nuclei-templates.

Share

Get a Telegram alert when the next one lands: LiteLLM advisories

All Litellm vulnerabilities →

Never Miss a Critical Alert

CVE advisories, breach reports, and threat intel — delivered daily to your inbox.