With One Admin Key, the AI Gateway Runs Their Code

LiteLLM CVE-2026-40217 lets anyone holding an admin key run code on the AI gateway, and CISA lists it as exploited.

LiteLLM, the open-source gateway between a company's apps and its AI providers, has a safety-rule test box that could let anyone holding an admin key run code on the server. CISA added that flaw, CVE-2026-40217, to its catalog of exploited bugs on 18 November 2026. Check every client's LiteLLM proxy today, starting with its version and its admin key.

TL;DR

What is CVE-2026-40217 and is it being exploited?

CVE-2026-40217 is a sandbox escape in BerriAI's LiteLLM proxy: the endpoint that tests a custom-code guardrail (a small Python rule that screens AI requests and replies) can be made to run any code on the server, per X41 D-Sec's advisory. The CVE record is rated 8.8 (CVSS) and assumes a low-privileged login, while LiteLLM rates it 5.9 because reaching the endpoint needs a proxy-admin credential in default configurations.

It is being exploited: CISA added CVE-2026-40217 on 18 November 2026 and set a due date of 2 December 2026 for federal agencies. The admin credential is a thinner wall than it sounds. Zenity Labs logged 47 different guessed master keys, including defaults such as sk-1234, and Obsidian Security showed that two other bugs, CVE-2026-47101 and CVE-2026-47102, let an ordinary user promote themselves to proxy admin.

This is a different problem from LiteLLM's backdoored 1.107.0 release: there the package was poisoned; here the genuine code has the flaw.

Which LiteLLM versions are affected?

Treat any LiteLLM proxy below v1.83.14-stable as affected. The sources differ by one release, so this article uses the later fix everywhere:

  • LiteLLM 1.81.8 up to 1.83.10: affected by CVE-2026-40217; LiteLLM's advisory lists 1.83.10 as patched.
  • LiteLLM below v1.83.14-stable: still open to the CVE-2026-47101 and CVE-2026-47102 route to the same endpoint; Obsidian Security says v1.83.14-stable closes the whole chain.
  • Docker main-latest images: X41 tested one specific digest, per X41 D-Sec (full value in check 2). Floating tags don't show a version, so read it from the installed package.

How do I check if my clients' LiteLLM proxy was hit?

Run these on each Linux or Docker host with sudo, in one shell. Zenity saw the first probes on 15 April 2026, so search the oldest retained logs; a clean result can't rule out an earlier break-in.

  1. Preserve evidence. Copy reverse-proxy logs, each LiteLLM container's logs and settings, and a database dump into one folder, then hash it. Pass: $D.sha256 lists every copied file.

    D=/root/ir-litellm-$(hostname)-$(date +%F); sudo mkdir -p "$D"   # holds secrets; keep it restricted
    sudo cp -a /var/log/nginx /var/log/caddy "$D"/   # an error for an absent proxy is expected
    for c in $(sudo docker ps -a --no-trunc | grep -i litellm | awk '{print $1}'); do sudo docker logs "$c" 2>&1 | sudo tee "$D/$c.log" >/dev/null; sudo docker inspect "$c" | sudo tee "$D/$c.json" >/dev/null; done
    pg_dump "<DATABASE_URL>" | sudo tee "$D/litellm-db.sql" >/dev/null   # DATABASE_URL is in the proxy's env or .env
    sudo find "$D" -type f -exec sha256sum {} + | sudo tee "$D.sha256"
    
  2. Read the installed version. Finds every LiteLLM package, image layers included, and any image with X41's tested digest. Pass: every folder name shows 1.83.14 or later, and the second command prints nothing.

    sudo find / -path /proc -prune -o -type d -name 'litellm-*.dist-info' -print 2>/dev/null
    sudo docker images --digests --no-trunc | grep -i bb0639701796218a3447160e55c0f1097446e4e6085df7dfd39f476d4143743f
    
  3. Test the tester and the key. From outside the client's network, see whether the tester answers on 443 or port 4000, then look for default keys Zenity saw guessed. Pass: every curl line prints 000 and both greps print nothing.

    for U in https://<host> https://<host>:4000 http://<host>:4000; do curl -sk -m 10 -o /dev/null -w "$U %{http_code}\n" -X POST "$U/guardrails/test_custom_code"; done
    # on the host:
    sudo grep -rnE 'sk-(1234|litellm-master-key|admin|changeme)\b' /etc /opt /srv /home --include='*.y*ml' --include='.env'
    sudo grep -lE 'LITELLM_MASTER_KEY=sk-(1234|litellm-master-key|admin|changeme)"' "$D"/*.json
    
  4. Search the logs. The first search matches IPs Zenity Labs published: a hit is contact with known attacker infrastructure, so treat it as a likely compromise and escalate. The second finds outside calls to the tester; review each. Pass: both print nothing.

    sudo find "$D" -type f ! -name '*.sql' -exec zgrep -hE '173\.249\.198\.201|108\.78\.4\.10|216\.26\.226\.182|125\.81\.162\.148|125\.81\.162\.48|5\.34\.179\.24|164\.52\.192\.134|62\.210\.172\.179' {} +
    sudo find "$D" -type f ! -name '*.sql' -exec zgrep -h 'POST /guardrails/test_custom_code' {} + | grep -Ev '^(10\.|192\.168\.|172\.(1[6-9]|2[0-9]|3[01])\.|127\.)'
    # Zenity lists both 125.81.162.148 and 125.81.162.48, so both are here.
    # Add the client's office and VPN ranges to the -Ev list. Container lines start with INFO: and show the proxy's address.
    
  5. List admins, guardrails and callbacks. Shows every proxy admin, every saved guardrail, and callbacks loaded from config, which Obsidian notes don't appear in the admin UI. Pass: every row and callback is one the client can name.

    psql "<DATABASE_URL>" -c "SELECT user_id, updated_at FROM \"LiteLLM_UserTable\" WHERE user_role = 'proxy_admin';"
    psql "<DATABASE_URL>" -c "SELECT guardrail_name, created_at, updated_at FROM \"LiteLLM_GuardrailsTable\";"
    sudo grep -rn -A5 'callbacks:' /etc /opt /srv /home --include='*.y*ml'
    
  6. Look for shells and scheduled jobs. Shows running children of the proxy, containers included (running processes only), and every user's cron jobs. Pass: no sh, bash, curl or wget under the proxy, and every cron entry is known.

    ps -eo pid,ppid,user,comm,args --forest | grep -B2 -A4 -E 'litellm|uvicorn'
    sudo ls -la /etc/cron* /var/spool/cron/*
    

How do I fix LiteLLM CVE-2026-40217 on client servers?

  1. Preserve evidence first. Confirm check 1's hash file exists before changing anything. Pass: the command prints ok.

    sudo test -s "$D.sha256" && echo ok
    
  2. Upgrade. Move each proxy to v1.83.14-stable or later and recreate the container, which also discards a container that ran attacker code. Pass: rerun check 2; every folder shows 1.83.14 or later.

    sudo docker pull ghcr.io/berriai/litellm:v1.83.14-stable
    sudo docker compose up -d --force-recreate   # or the client's own run command, with the new tag
    sudo <venv>/bin/pip install --upgrade 'litellm[proxy]>=1.83.14'   # pip installs
    
  3. Block the tester if the upgrade must wait. This temporary rule is LiteLLM's workaround. Pass: check 3's curl prints 403.

    # nginx, inside the LiteLLM server block:
    location = /guardrails/test_custom_code { return 403; }
    # Caddy, inside the site block:
    respond /guardrails/test_custom_code 403
    
  4. Remove footholds. Delete guardrails and demote admins from check 5 that the client can't name; if check 6 found a shell on a pip host, rebuild that host. Pass: rerun check 5; every row is named.

    psql "<DATABASE_URL>" -c "DELETE FROM \"LiteLLM_GuardrailsTable\" WHERE guardrail_name = '<name>';"
    psql "<DATABASE_URL>" -c "UPDATE \"LiteLLM_UserTable\" SET user_role = 'internal_user' WHERE user_id = '<id>';"
    
  5. Rotate secrets. Change the master key per LiteLLM's rotation guide (with LITELLM_SALT_KEY set, change the variable and restart), plus the database password; rotate OpenAI keys on the API Keys page and review Usage, per OpenAI. Pass: the old master key gets 401.

    curl -sk -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer <old-master-key>" https://<host>/v1/models
    
  6. Rerun checks 2 to 6. Pass: each check meets its own Pass line.

Where KinoSec fits

KinoSec's autonomous web app pentest checks whether each client's LiteLLM proxy exposes its admin routes, including the guardrail tester, to the internet. It runs reconnaissance on each client's external surface, finds the vulnerabilities there, chains them the way an intruder would, and writes up findings with remediation you can hand the client. It won't read the proxy's database, so checks 5 and 6 still matter. A self-hosted AI gateway is now part of the attack surface, much like the GPUStack server that accepted a fake header as an admin login. Add autonomous web app and API pentesting for all your clients to the work you already do for them.

Frequently Asked Questions

Is CVE-2026-40217 related to the backdoored LiteLLM 1.107.0 release?

No. CVE-2026-40217 is a flaw in LiteLLM's own code: the custom-code guardrail tester can be made to run code outside its sandbox, per X41 D-Sec. The 1.107.0 incident was a poisoned package that stole cloud and AI keys. A client can be hit by one and not the other, so check for both.

How do I check if a client's LiteLLM proxy was attacked?

Read the installed version with sudo find / -name 'litellm-*.dist-info' 2>/dev/null; anything older than 1.83.14 is exposed. Search the reverse-proxy logs with zgrep 'POST /guardrails/test_custom_code' <log>; a hit from an IP Zenity Labs published is contact with known attacker infrastructure, so treat it as a likely compromise and escalate. Then list processes with ps -eo pid,ppid,user,comm,args --forest and look for shells under the proxy.

What if a client can't upgrade LiteLLM today?

Block POST /guardrails/test_custom_code at the reverse proxy, as LiteLLM's advisory suggests, and confirm it returns 403. Change the master key away from any default, and keep the management interface off untrusted networks, as X41 D-Sec advises. This is temporary; the upgrade to v1.83.14-stable is the fix.

Should a client's LiteLLM admin interface be reachable from the internet?

X41 D-Sec advises keeping the management interface off untrusted networks, and Zenity Labs describes the guardrail tester as a low-traffic admin endpoint that should not see internet traffic. Apps that call the gateway can reach it over a private network or VPN instead. Put that in the client's hardening plan alongside the upgrade.