On November 18, 2026, CISA added CVE-2026-40217, a code-execution flaw in the LiteLLM proxy, to the Known Exploited Vulnerabilities catalog. LiteLLM is the open-source gateway a lot of teams put in front of OpenAI, Anthropic, Azure OpenAI, Bedrock and Vertex so applications get one API and one set of virtual keys. That design concentrates every upstream provider credential in one process. Treating this as a routine patch misses the point: if the gateway was compromised before you upgraded, the attacker already has keys that work without it, and upgrading LiteLLM doesn't revoke them.
This post covers what the advisory and threat reporting actually say, how to find LiteLLM in your environment, and detections at three layers: the gateway's own HTTP routes, the gateway host, and the cloud AI services whose keys it holds.
What the sources say
The primary record is the LiteLLM advisory, GHSA-wxxx-gvqv-xp7p, mirrored in the GitLab advisory database:
- The
POST /guardrails/test_custom_codeendpoint runs user-supplied Python inside a home-grown sandbox meant for testing custom guardrails. The sandbox can be escaped with bytecode-level techniques, giving arbitrary code execution in the proxy process. - In the default Docker image, that process runs as root.
- Affected: versions from 1.81.8 up to, but not including, 1.83.10. The advisory says reaching the endpoint requires a proxy-admin credential in default configurations. CVSS 3.1 is 8.8 with a low-privilege vector; CWE-420 and CWE-913.
- CISA's KEV entry was added on November 18 with a federal remediation due date of December 2, 2026, as reported by SecurityOnline and the Cloud Security Alliance research note. Check the KEV catalog for the current entry.
The exploitation context comes from Google Threat Intelligence Group and Mandiant's November 2 LLMjacking report. It describes a follow-on cluster that received pre-validated LiteLLM virtual keys from an initial-access actor and escalated them to PROXY_ADMIN master credentials. The same report describes LLMjacking incidents with fraudulent consumption over $100,000 in a single day and cumulative charges reaching $1 million at some organizations before access was revoked. Those figures are for LLMjacking broadly, not this CVE alone.
Google's report describes CVE-2026-40217 as a user ID rebind issue in the /key/regenerate endpoint used to escalate to PROXY_ADMIN. The advisory, CISA and the original researchers describe it as the guardrail sandbox escape. The CSA note suggests Google grouped several steps of an escalation chain under one ID; that's CSA's inference, not confirmed. For detection the difference doesn't matter much: watch both the key and user management routes and the guardrail routes, because a low-privilege virtual key that becomes admin is the path to the code-execution bug.
That second point is why the "requires admin" language shouldn't make you relax. The advisory's admin requirement and the CVSS vector's low-privilege rating already disagree, and the Google report shows an actor obtaining ordinary virtual keys and turning them into admin. If anyone outside the platform team holds a virtual key, assume the admin boundary can be crossed.
Step one: find every LiteLLM instance
AI gateways are often deployed by application or data science teams, not platform engineering, so your CMDB is probably incomplete. Check in this order:
- Container registries and Kubernetes: images from
ghcr.io/berriai/litellmand its variants, and any Helm release with litellm in the name. - Python environments: the
litellmpackage in requirements files and SBOMs. Many apps import it as a library without running the proxy. Library-only use isn't exposed to this bug, but note it, because those apps hold provider keys too. - Network: LiteLLM's proxy listens on port 4000 by default. Internet-facing services on 4000 that answer with LiteLLM's admin UI or OpenAPI page need attention first.
- Endpoint telemetry: the process hunt below doubles as an inventory query if you drop the child-process filter.
Record for each instance: version, whether the admin UI and management routes are reachable from outside the platform team's network, who holds virtual keys, and which provider credentials the gateway holds. The last list is your rotation scope if anything below fires.
Detection 1: The routes that matter in proxy access logs
LiteLLM normally sits behind nginx, an ingress controller or a cloud load balancer. Normal application traffic hits the inference routes (/chat/completions, /v1/..., /embeddings). The routes below are administrative and should be rare and predictable. This search assumes access logs with CIM-style fields (uri_path, method, status, clientip), as produced by the standard access_combined extractions; adjust the index and sourcetype to yours.
index=web sourcetype IN ("access_combined", "nginx:plus:access") earliest=-30d (uri_path="/guardrails*" OR uri_path="/key/*" OR uri_path="/user/*" OR uri_path="/config/update" OR uri_path="/model/new") | eval route=case( like(uri_path, "/guardrails/test_custom_code%"), "guardrail_code_test", like(uri_path, "/guardrails%") AND method IN ("POST", "PUT"), "guardrail_write", like(uri_path, "/key/%"), "key_management", like(uri_path, "/user/%"), "user_management", true(), "config_or_model_change") | stats count min(_time) as first_seen max(_time) as last_seen values(status) as statuses values(uri_path) as paths by clientip route | convert ctime(first_seen) ctime(last_seen) | sort route - count
Any guardrail_code_test hit you can't tie to a platform engineer testing a guardrail is an incident: normal traffic never touches it. guardrail_write is the persistent version, since custom-code guardrails saved through POST /guardrails or PUT /guardrails/{id} run on future requests. Key and user management traffic is normal from your admin tooling, so the useful question is who, which the next search answers.
Request bodies aren't in standard access logs. If you need to see whether a key update set broad allowed_routes or a user update changed user_role, you'll need the LiteLLM database itself or request logging at the gateway. Plan for that before an incident, not during.
Detection 2: New sources calling management routes
The escalation path in Google's report starts with a valid, low-privilege virtual key. The traffic looks authenticated and well formed. What gives it away is the source: a client that has only ever called inference routes, or has never been seen before, starting to call key, user or guardrail routes.
index=web sourcetype IN ("access_combined", "nginx:plus:access") earliest=-31d (uri_path="/guardrails*" OR uri_path="/key/*" OR uri_path="/user/*" OR uri_path="/config/update" OR uri_path="/model/new") | stats min(_time) as first_seen max(_time) as last_seen count values(uri_path) as paths by clientip | where first_seen >= relative_time(now(), "-1d") | convert ctime(first_seen) ctime(last_seen) | sort - count
Run it daily. Expect noise when admins work from new networks or a new CI runner gets an IP; keep a lookup of known admin sources and filter them out. If clients sit behind a load balancer that rewrites the source, use the X-Forwarded-For field instead of clientip, or you'll baseline the load balancer.
Detection 3: The gateway process spawning things it shouldn't
Successful exploitation means attacker Python running inside the proxy process. From there the next steps are predictable: read the environment, dump the database connection string, pull more tooling. If the host or node has Defender for Endpoint on Linux, a LiteLLM process spawning a shell or a download tool is high-confidence. Confirm how your deployment launches LiteLLM (the litellm CLI, or uvicorn/gunicorn with LiteLLM's app) and adjust the match.
let lookback = 30d; DeviceProcessEvents | where TimeGenerated > ago(lookback) | where InitiatingProcessCommandLine has "litellm" or InitiatingProcessParentFileName has "litellm" | where FileName in~ ("sh", "bash", "dash", "ash", "zsh", "curl", "wget", "nc", "ncat", "socat", "python", "python3", "perl", "base64", "env", "printenv", "cat", "psql", "pg_dump") | project TimeGenerated, DeviceName, AccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, FileName, ProcessCommandLine, FolderPath | order by TimeGenerated desc
Some deployments run health checks, startup scripts or database migrations through a shell or helper processes when the container starts. Baseline those in the first week by command line, then alert on anything else. env, printenv or cat against /proc/self/environ or a config file from a running proxy is worth an immediate look: that's where the master key, database URL and provider keys live.
Detection 4: New outbound destinations from the gateway
A gateway talks to a fixed set of model provider endpoints, its database and maybe a logging service. A new destination is either a newly configured model, or something sending data out. Configured models with an attacker-controlled api_base are one of the persistence mechanisms the CSA note calls out, and they look exactly like this.
let baselineStart = ago(15d); let baselineEnd = ago(1d); let litellmNet = DeviceNetworkEvents | where TimeGenerated > baselineStart | where InitiatingProcessCommandLine has "litellm" | where RemoteIPType == "Public" | extend Dest = iff(isnotempty(RemoteUrl), RemoteUrl, RemoteIP); let baseline = litellmNet | where TimeGenerated < baselineEnd | distinct DeviceName, Dest; litellmNet | where TimeGenerated >= baselineEnd | join kind=leftanti baseline on DeviceName, Dest | summarize Connections = count(), FirstSeen = min(TimeGenerated), Ports = make_set(RemotePort, 5) by DeviceName, Dest, RemoteIP | order by FirstSeen asc
Provider endpoints behind CDNs rotate IPs, which is why the query prefers RemoteUrl when it's populated. Where it isn't, you'll see new IPs for known providers; resolve and allowlist them rather than dropping IP-only rows, since direct-to-IP connections are exactly what exfiltration tooling tends to use.
Detection 5: Your provider keys being used without the gateway
This is the detection that still works after the attacker has left the gateway. A stolen provider credential is used from the attacker's infrastructure, so the identity is the gateway's but the source isn't. For Bedrock, that shows up in CloudTrail. Google's report lists the runtime calls (InvokeModel, InvokeModelWithResponseStream, Converse), model-access changes, and invocation-logging changes as the events to watch.
let lookback = 7d; let gatewayPrincipals = dynamic(["arn:aws:iam::111122223333:role/litellm-gateway"]); // your gateway identities let gatewayEgress = dynamic(["203.0.113.10", "203.0.113.11"]); // your gateway NAT IPs let inference = dynamic(["InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream"]); let control = dynamic(["PutModelInvocationLoggingConfiguration", "DeleteModelInvocationLoggingConfiguration", "PutUseCaseForModelAccess", "CreateFoundationModelAgreement"]); AWSCloudTrail | where TimeGenerated > ago(lookback) | where EventSource == "bedrock.amazonaws.com" | where (EventName in (inference) and UserIdentityArn has_any (gatewayPrincipals) and SourceIpAddress !in (gatewayEgress)) or EventName in (control) | summarize Calls = count(), Errors = countif(isnotempty(ErrorCode)), Regions = make_set(AWSRegion, 10), Agents = make_set(UserAgent, 5), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by UserIdentityArn, SourceIpAddress, EventName | order by FirstSeen asc
Role sessions show up with an assumed-role ARN, so match on the role name with has_any as above rather than exact equality. The control arm fires on any principal: invocation logging changes and model-access agreements should come from your infrastructure-as-code pipeline, and Google's report flags logging being disabled by a non-IaC principal as high severity. A burst of Errors across many regions is the validation sweep pattern Google describes, where the actor tests which models and regions a key can reach.
For Azure OpenAI, the key itself is used against the data plane, which only appears if diagnostic logging is enabled on the resource. The control plane is logged regardless, and key listing is how an attacker with stolen Azure credentials gets a fresh API key:
let lookback = 14d; AzureActivity | where TimeGenerated > ago(lookback) | where OperationNameValue in~ ( "MICROSOFT.COGNITIVESERVICES/ACCOUNTS/LISTKEYS/ACTION", "MICROSOFT.COGNITIVESERVICES/ACCOUNTS/REGENERATEKEY/ACTION", "MICROSOFT.COGNITIVESERVICES/ACCOUNTS/DEPLOYMENTS/WRITE", "MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE") | where ActivityStatusValue in~ ("Success", "Succeeded") | summarize Count = count(), Resources = make_set(_ResourceId, 10), FirstSeen = min(TimeGenerated) by Caller, CallerIpAddress, OperationNameValue | order by FirstSeen asc
Your deployment pipeline and the gateway's own managed identity will show up here legitimately. Allowlist those callers, and anything left over (especially a user account listing keys from an unfamiliar IP, or a new model deployment nobody requested) is worth a ticket. A deleted diagnostic setting on a Cognitive Services account is worth one on its own.
If you find something: response order
- Contain the gateway. Block external access to the admin and management routes at the proxy or ingress. If you can't patch immediately, deny
POST /guardrails/test_custom_codeat the reverse proxy; CSA and other write-ups recommend this as an interim control. Snapshot the container or host and the LiteLLM database before changing anything. - Rotate everything the gateway held, upstream first. Every provider API key, cloud IAM credential and managed identity secret the gateway used, then the LiteLLM master key, the database password, and all virtual keys. Rotating virtual keys alone does nothing about the provider keys the attacker already copied.
- Check the gateway's stored configuration for persistence. Upgrading doesn't remove what an attacker saved in the proxy database. Look for
proxy_adminusers you don't recognize, custom-code guardrails your team didn't write, callbacks you didn't configure, and model entries whoseapi_basepoints somewhere unfamiliar. - Check the bill. Pull per-model usage and cost for every provider account the gateway touched for the exposure window. Unexpected models, regions or volume are evidence of key use outside the gateway, and the providers' fraud teams will want the timeline.
- Upgrade. The advisory lists 1.83.10 as fixed. The CSA note recommends 1.83.14-stable or later as a baseline because it also contains fixes for the related privilege-escalation issues. Pin to a specific version tag rather than a floating tag like
latest.
Hardening AI gateways
- Split the planes. Expose only inference routes to applications. Put the admin UI and the key, user, guardrail and config routes on a separate listener or path restricted to a management network. This single change turns most of this attack chain into a non-starter.
- Don't run it as root. The default image runs the proxy as root. Run it as a non-root user with a read-only root filesystem where your deployment allows.
- Scope and expire virtual keys. Give each application its own key with only the models and routes it needs, budgets, and an expiry. A leaked key with a budget cap limits both the bill and the reach.
- Prefer workload identity over static provider keys. Where providers support it (Bedrock with IAM roles, Azure OpenAI with managed identities, Vertex with service account impersonation), the gateway holds short-lived credentials an attacker can't take home and use for months.
- Turn on provider-side logging and budget alerts. Bedrock invocation logging, Azure diagnostic settings on Cognitive Services accounts, and Vertex AI data access logs (Google notes these are disabled by default). Budget alerts are a crude detection, but they fire when everything else was missed.
- Avoid custom-code guardrails, or isolate them. Running user-supplied Python inside the gateway process is the root cause here. If you need custom guardrail logic, run it as a separate service the gateway calls, with no access to the gateway's secrets.
AI gateways have become one of the highest-value secrets stores in the environment, and most SOCs aren't watching them like one. CVE-2026-40217 will be patched within a few weeks at most organizations; the provider keys copied before that won't expire on their own. Find every gateway, look at who has been calling its admin routes, and watch your model providers' logs for your own credentials coming from someone else's infrastructure. That last detection keeps paying off long after this CVE is old news.
Every issue includes a full detection rule for Sentinel, CrowdStrike or Splunk, with investigation steps, false positive guidance and MITRE mapping. Platforms rotate so you get broad coverage over time.
Join — $14.99/mo See a Sample Issue