Skip to content
    ← All news

    Attackers are typing sk-1234 into AI gateways. Is your LiteLLM key still the example?

    · Zero Agency

    Share

    You put one proxy in front of every model you pay for. OpenAI, Anthropic, AWS, all of it. Your apps and agents get cheap virtual keys, and the real keys live in one place.

    That one place is now on CISA's list of software attackers are actively breaking into.

    On November 18, CISA added a LiteLLM flaw, CVE-2026-40217, to its Known Exploited Vulnerabilities catalog. The bug lets code sent to a test endpoint escape its sandbox and run inside the proxy. And the honeypot data behind it shows what attackers try first: not a clever exploit, but the example password.

    TL;DR

    • LiteLLM is an open source AI gateway with over 63,000 stars on GitHub. CVE-2026-40217 is a sandbox escape in its POST /guardrails/test_custom_code endpoint, which runs code in the proxy process, as root in the default Docker image, per LiteLLM's advisory.
    • Affected: versions 1.81.8 up to 1.83.10. The advisory text says to upgrade to 1.83.11 or later. That is the safe target.
    • The endpoint needs a proxy-admin credential. Zenity's honeypots saw 569 attack requests, each guessing a master key like sk-1234, sk-admin or sk-changeme.
    • The captured payloads dumped the proxy's environment, where your provider API keys live, and ran shell commands.
    • Fix order: upgrade, change the master key to a random value, take the admin side off the internet, run as non-root, then rotate provider keys if anything looks off.

    What is CVE-2026-40217 in plain words?

    LiteLLM lets you write "guardrails", small Python functions that inspect traffic and decide to allow, block or change it. Think of a filter that strips personal data from prompts.

    To make writing them easier, there is an endpoint that runs your guardrail code against a test input. That code runs inside a homemade sandbox. Zenity's write-up explains the sandbox was mostly a list of banned words, such as import and globals. Attackers just built those words from fragments at runtime, like "gl" + "ob" + "als", and walked back to Python's real import function.

    The fix replaced the homemade sandbox with RestrictedPython, a library built for this job.

    My opinion: "run user Python on the server, safely" is one of the hardest problems in software, and a deny-list of words was never going to hold. If a tool you run offers a "test your code here" button, assume it is a remote code execution feature with a lock on the door, and treat the lock as the only thing that matters.

    Why does the default master key matter so much here?

    Because the lock on the door is the master key.

    LiteLLM's advisory says reaching the endpoint "requires a proxy-admin credential in default configurations." That sounds reassuring until you look at what attackers sent. Zenity's sensors logged 47 different guessed keys, plus 64 requests with an empty key. All of them were LiteLLM-flavored defaults. Zenity notes that sk-1234 is the example key from LiteLLM's own docs and an old .env.example file.

    So the real attack is two steps:

    1. Guess the master key from a short list of examples people copy and never change.
    2. If it works, send the sandbox escape and take the server.

    The CVE gets the headline. The default password does the work. We saw the same pattern yesterday with NanoClaw's credential database shipping with the password "onecli". The most dangerous line in an AI stack is often the one you pasted from a quick start guide.

    Credit where due: LiteLLM's current Docker quick start now generates a random master key with openssl rand -hex 32, and binds the port to 127.0.0.1. The docs also say the master key "authorizes every management API call and serves as the default Admin UI password." If you set yours up a while ago, you may still have the old habit, not the new one.

    What did the attackers actually do?

    Zenity recorded traffic between April 15 and May 24, 2026. The first probes landed the same day the fix shipped.

    It came in two waves:

    • Recon. 520 identical requests sent a guardrail that just returned {'probe':1}. A success reply answers two questions at once: the key works, and this endpoint runs my code.
    • Exploitation. Hand-written payloads, from different IPs, that escaped the sandbox. One serialized the whole environment and sent it back, filtering for names like openai, anthropic, aws and master. Another started a shell command in the background to dodge the endpoint's timeout.

    Zenity replayed both captured payloads in a lab on a vulnerable version and confirmed they leaked a planted secret and ran commands.

    Think about what sits in that environment: your model provider keys, usable outside your gateway's budgets, plus database and cloud credentials if you put them there.

    How do I check if my LiteLLM proxy is affected?

    Three questions, in this order.

    1. Which version is running? Not the one in your lock file, the one in the running container:

    docker exec <litellm-container> pip show litellm | grep Version
    

    Anything from 1.81.8 up to before 1.83.10 is in the affected range. Go to 1.83.11 or later. For context, the current releases are in the 1.108 line, so if you are on 1.83 you are many months behind on other fixes too.

    2. Is your master key a default? Check LITELLM_MASTER_KEY or general_settings.master_key. If it is sk-1234, anything that looks like an example, or something a human typed, change it now.

    3. Can the internet reach the admin side? From outside your network, try the proxy's address on port 4000. If the admin UI or /guardrails/test_custom_code answers, that is your exposure.

    Then look back. Search your reverse proxy or gateway logs for POST /guardrails/test_custom_code. Zenity calls it a low-traffic admin endpoint and recommends alerting on any external POST to it.

    How do I fix it, step by step?

    1. Upgrade to 1.83.11 or later. Internet-facing proxies first.
    2. Block the endpoint at your reverse proxy if you cannot upgrade today. This is the workaround in the advisory.
    3. Set a random master key, for example sk- plus openssl rand -hex 32. Update the apps that use it.
    4. Keep the control plane private. The admin UI and management routes do not need to face the internet. Put them behind a VPN or an allowlist.
    5. Run as non-root. LiteLLM's production docs show LITELLM_NON_ROOT and a runAsNonRoot security context. An escape as a normal user is a bad day. An escape as root is a lost server.

    Should I rotate my provider API keys?

    If your proxy was on an affected version, reachable from the internet, and had a guessable master key at any point since April: yes. Rotate the provider keys, the master key and any database password in that environment, starting with the keys that can spend money.

    If your logs show requests to the test endpoint you did not make, treat it as an incident, not a patch ticket.

    Speed matters more than it used to. Exploits now arrive within days, sometimes hours, of a fix. We made that case in why a 30-day patch window is already late. Here the probes started on fix day.

    Is it still smart to self-host an AI gateway?

    Yes. One place for budgets, logs and key control is worth a lot when agents make thousands of calls a day.

    But every key you centralize raises the value of the single password in front of it. Treat your gateway like your production database: random secrets, private admin access, least privilege, and someone who reads the advisories.

    FAQ

    Which LiteLLM versions are vulnerable to CVE-2026-40217? Versions 1.81.8 up to but not including 1.83.10. The advisory text points to 1.83.11 or later as the upgrade target.

    Is CVE-2026-40217 exploited in the wild? CISA added it to its exploited list on November 18, 2026. Zenity reported exploitation attempts against its honeypots from April 15, 2026.

    Can someone exploit it without a key? In default configurations the endpoint needs a proxy-admin credential. Attackers work around that by guessing default keys like sk-1234.

    What is the CISA deadline? December 2, 2026 for US federal civilian agencies. Everyone else should move faster.

    Does upgrading fix a leaked key? No. Upgrading closes the hole. Keys that were read before the upgrade stay valid until you rotate them.

    Share this post