A LiteLLM test endpoint fed a mining botnet
Strict rules refuse key steps
In April 2026, a botnet called PoeLLM took over more than 3,400 exposed servers, LiteLLM AI gateways among them, likely through a test feature that started any command a web request named. With strict rules, Tego would refuse the malware download, the mining and the scans: the server can only reach the hosts you list. We reproduced the incident's steps under these rules to confirm it. Attacker code could still read the keys the gateway itself holds.
What happened?
LiteLLM's proxy is a gateway that AI agents and apps send their model calls through. It can also start MCP servers: small local programs that give models extra tools, run by the proxy itself.
LiteLLM's advisory, published 21 April 2026 as CVE-2026-42271, describes the bug. Two web addresses that preview an MCP server, POST /mcp-rest/test/connection and POST /mcp-rest/test/tools/list, accepted a full description of the program to start: its command, args and env. They started that command "with the privileges of the proxy process", and any valid proxy key was enough. Version 1.83.7 requires the admin role, "bringing them into line with the save endpoint". So an admin can still start local programs this way.
Horizon3 showed the bug chains with CVE-2026-48710, a flaw in Starlette, the Python web library underneath, to skip the key check. In Starlette up to 1.0.0, a malformed Host header could slip past checks based on the request's path (Starlette advisory). Horizon3 scores the chain 10.0 out of 10 for severity; LiteLLM scores its own bug 8.7. CISA, the US cyber agency, added CVE-2026-42271 to its catalog of exploited bugs on 8 June.
On 7 October, BleepingComputer reported Lumen Black Lotus Labs' findings. Infected servers probe other servers' ports 3000 and 4000. An exploit server sends a target a crafted request "instructing it to download a file from the C2 on port 81", C2 being the attacker's command server. Lumen says /mcp-rest/test/connection "was likely the exploitation path".
Lumen does not say how PoeLLM got past the key check. A decompiled exploit string in its Figure 9 has a (bypass) suffix and a/?x= next to the test path, shaped like the Starlette trick, but that is a screenshot, not Lumen's words.
Figure 9 also shows the payload, a Python script run with python3 -c. It fetches http://<host>:81/anonymus/client to /tmp/c, first with curl, then wget, both through a shell, then with Python's own download function, and makes the file runnable by anyone.
The malware is a Linux program named libgcrypt, holding a remote shell, the XMRig and Iron cryptocurrency miners, and scanning and exploit tools. It connects to Kryptex mining infrastructure and checks in with its command server on port 3778, 5001, 5002 or 9999. It finds that server's address in four keywords of a poem on GitHub, which has changed 11 times. Victims become exploit servers for the next ones.
Lumen's summary says "more than 3,400 victim servers", its body "almost 2,200"; BleepingComputer notes Lumen raised the figure from 2,100. Not all were AI servers: victims ran LiteLLM and Ollama, and hundreds ran Gotenberg, a PDF converter, or Gitea, a code host. Activity peaked in mid-June at nearly 800 servers in a day. No source reports the malware making itself survive a reboot, or whether the proxies ran as root or in a container.
Why didn't the usual safety catch it?
The key check was the only guard, and the Starlette flaw skipped it. Behind it, a started program had every right the proxy had: run any program, write anywhere the proxy could, connect to any server.
How it could have been prevented
Patch first: LiteLLM 1.83.7 and Starlette 1.0.1, or block both test paths at a reverse proxy. But the habit that prevents this kind of harm needs no knowledge of the bug. Decide what the gateway may do once something gets in: start no programs, reach only its model providers, write one folder.
Tego enforces those limits from outside the program, with the Linux kernel. Picture the proxy started under Tego, as its own user. Tego sees connections and programs, not web requests, so the crafted request and the key bypass still reach the proxy (network controls).
Every host but the two model providers is refused, so the port 81 download, the Kryptex pool, the command server check-in and the scans of other servers all fail (what each level enforces, Tego's known limits, item C47). For TCP, the check can't be raced; Lumen does not name the protocol. Writes outside the state folder fail, so /tmp/c is never saved, and nor is a startup entry in a cron file, ~/.bashrc or authorized_keys (what each level enforces). The proxy may listen only on its own port, so a remote shell can't open a new one (network controls).
After one normal run, Tego can list the programs the proxy really started and refuse every other one. For a proxy that starts none, sh, curl, wget and a dropped miner all fail with a permission error (contract semantics, section 4, the contract spec, rule R8, Tego's known limits, item A2). The cost: no MCP servers started by the proxy, even an admin's.
Each refusal is written into Tego's record of the run, so a gateway reaching for port 81 on an unknown host stands out. Without root, Tego calls that record advisory against a hostile process: useful, but not proof (what each level enforces).
Tego's strict setup is three built-in rule sets: the agent can't read your secrets, can only reach the hosts you list, and can only change files in the folders you name.
In Tego's rules file, that's:
extends: [tego/no-secrets, tego/no-prod, tego/repo-only-writes]
fs:
write: ["/var/lib/litellm/state/"] # the proxy's state folder
net:
allow: ["api.openai.com:443", "api.anthropic.com:443"] # the model providers it serves
listen: ["tcp://0.0.0.0:4000"] # its own port, and no new listenerRun it without root (TIERS) as a service, from Tego's example systemd unit, with linger on so it keeps running after you log out (operations guide); every program the proxy starts stays under the rules (README). Keep the home folder unwritable (rules spec). Pass the provider keys through, and set LITELLM_LOCAL_MODEL_COST_MAP=True so it doesn't fetch prices from GitHub at startup, as LiteLLM documents for firewalls. Don't allow GitHub instead: the poem lives there. Tego runs on Linux (README); inside a container it supports only the no-root mode, which has not been run by hand.
The honest limit is Python: whether the attacker's python3 starts depends on the install (what each level enforces, contract semantics), and the proxy's own Python can load native code (Tego's design note on executable memory), read the proxy's keys, mine inside its own memory and send data out through the allowed providers or the proxy's replies (Tego's known limits, item A1, README), so cap its CPU with limits: {cpu: 2} (runtime launch) and treat the keys as exposed.
The lesson
A gateway that can start programs is a remote command runner for whoever reaches that feature. Patch it and keep test endpoints off the internet, but also decide what the started program can do next: start nothing, reach two providers, write one folder. Horizon3 lists rotating the proxy's stored credentials as a fallback when patching must wait.
Sources (18 links)
Checked on 6 November 2026.
- Lumen Black Lotus Labs, Canto incognito: tracking the PoeLLM malware. The page carries no date; its data runs to 25 September 2026. Figure 9 shows the exploit string.
- BleepingComputer, PoeLLM malware infects exposed AI servers in cryptomining attacks, 7 October 2026.
- BerriAI, GHSA-v4p8-mg3p-g94g, the repository advisory, 21 April 2026, and the v1.83.7-stable release, 19 April 2026. Horizon3's timeline dates the fix 8 May 2026.
- Horizon3.ai, CVE-2026-42271: LiteLLM Unauthenticated RCE.
- Starlette, GHSA-86qp-5c8j-p5mr, 21 May 2026. Horizon3 dates public disclosure 26 May 2026.
- CISA, Known Exploited Vulnerabilities feed, catalog version 2026.11.04.
- LiteLLM docs, model cost map and token usage.
- Tego: README, GAPS.md, contract semantics (including its stated limits, L878), backend capabilities (including UDP) and the agent schema (main, f01b19d).
Read next
Previous teardown
An agent deleted production in nine seconds
Strict rules refuse key steps
Next teardown
Twelve unpushed commits gone at session start
Strict rules refuse key steps
Start here
Eleven agent incidents and the rule for each
Eleven agent incidents, each in one line.