LiteLLM CVE-2026-40217 — exploited custom guardrail sandbox escape

Threat Overview

CISA added LiteLLM CVE-2026-40217 to Known Exploited Vulnerabilities on November 18, 2026. The POST /guardrails/test_custom_code endpoint executes custom Python guardrail tests; bytecode manipulation can escape the original sandbox and execute commands in the LiteLLM proxy process, potentially root inside the default container. The vendor advisory says the endpoint requires a proxy-admin credential in default configurations. CISA confirms exploitation, but has not published an incident-specific IOC set. Researchers disagree whether a separately documented /key/regenerate privilege escalation was conflated with this CVE; do not assume the same exploit chain.

References

Impacted Systems

BerriAI LiteLLM proxy (Python package or self-hosted Docker/container AI gateway), versions >=1.81.8 and <1.83.10 per GitHub advisory. The advisory text recommends 1.83.11 or later, despite listing 1.83.10 as first patched; use a current supported version. Proxy-admin access is required by default. Publicly reachable proxy endpoints increase exposure. Library-only installations not running the proxy endpoint are outside the demonstrated endpoint attack surface.

Why this matters

An AI gateway aggregates high-value provider credentials and may have cloud or CI privileges. Compromise can expose credentials and enable command execution.

Exploitation Status

CISA KEV addition November 18 confirms exploitation; public attribution, scope and IOCs remain unverified. Related /key/regenerate escalation is distinct and should not be equated with the sandbox escape.

What this hunt looks for

Potentially high consequence in affected exposed deployments. Customer impact cannot be determined without verified product inventory and executed telemetry review.

Required logs

Public vendor advisories and security research were reviewed; no customer Microsoft Sentinel telemetry was queried. Proposed hunts require the indicated ingested data classes: normalized web sessions, Azure WAF diagnostics, Defender endpoint telemetry and/or Syslog.

L01 — Custom guardrail test endpoint (first pass)

_Im_WebSession | where TimeGenerated >= ago(30d) | where Url has "/guardrails/test_custom_code" | summarize Requests=count(), FirstSeen=min(TimeGenerated), LastSeen=max(TimeGenerated), Methods=make_set(HttpMethod,5) by SrcIpAddr, DstHostname, Url | order by Requests desc

L02 — WAF guardrail endpoint access

AzureDiagnostics | where TimeGenerated >= ago(30d) | where Category has "Firewall" | where requestUri_s has "/guardrails/test_custom_code" | summarize Hits=count(), Actions=make_set(action_s,10), LastSeen=max(TimeGenerated) by clientIP_s, requestUri_s

L03 — Python proxy spawning shells

DeviceProcessEvents | where TimeGenerated >= ago(30d) | where InitiatingProcessFileName in~ ("python","python3","uvicorn","gunicorn") | where FileName in~ ("sh","bash","dash","curl","wget","python","python3","nc") | project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessCommandLine, InitiatingProcessFileName | order by TimeGenerated desc

L04 — LiteLLM container credential file access

DeviceFileEvents | where TimeGenerated >= ago(30d) | where InitiatingProcessCommandLine has_any ("litellm","uvicorn") | where FolderPath has_any (".aws/credentials",".azure",".kube/config",".env","/secrets/") | project TimeGenerated, DeviceName, ActionType, FolderPath, InitiatingProcessCommandLine

L05 — Proxy process outbound destinations

DeviceNetworkEvents | where TimeGenerated >= ago(30d) | where InitiatingProcessCommandLine has_any ("litellm","uvicorn") | where RemoteIPType == "Public" | summarize Connections=count(), FirstSeen=min(TimeGenerated), LastSeen=max(TimeGenerated) by DeviceName, RemoteUrl, RemoteIP, InitiatingProcessCommandLine | order by Connections asc

L06 — Unexpected new proxy destinations

let baseline=DeviceNetworkEvents | where TimeGenerated between (ago(30d)..ago(7d)) | where InitiatingProcessCommandLine has "litellm" | summarize by DeviceName, RemoteIP; DeviceNetworkEvents | where TimeGenerated >= ago(7d) | where InitiatingProcessCommandLine has "litellm" | where isnotempty(RemoteIP) | join kind=leftanti baseline on DeviceName, RemoteIP | summarize FirstSeen=min(TimeGenerated), Events=count() by DeviceName, RemoteIP, RemoteUrl

L07 — Azure service principal activity following gateway compromise

AADServicePrincipalSignInLogs | where TimeGenerated >= ago(30d) | summarize SignIns=count(), IPs=dcount(IPAddress), FirstSeen=min(TimeGenerated), LastSeen=max(TimeGenerated), SampleIPs=make_set(IPAddress,10) by ServicePrincipalName, AppId | where IPs > 3 | order by IPs desc

Detection Notes

First-pass HTTP endpoint searches are the highest-confidence exploit-surface leads where web logs contain full URL paths. Process creation by web/AI services, new outbound connections and suspicious file writes are follow-up behaviors, not proof of this CVE. Normalized _Im_WebSession is available only when ASIM web session normalization is deployed; AzureDiagnostics fields require legacy WAF diagnostic mode and may differ with resource-specific tables. Defender queries require actual endpoint onboarding and sufficient retention. Review process command lines and deployment context before escalation; missing logs make the corresponding hunt inapplicable. Queries are prepared, not runtime-validated.

Leave a Reply