The Router in the Middle

A UC Santa Barbara study published April 9, 2026 ran 428 LLM API routers through live traffic and found nine actively rewriting payloads in transit. It bought 28 paid routers on Taobao, Xianyu, and Shopify and pulled 400 more free ones off GitHub. Seventeen reached into a planted AWS credential the moment it crossed their proxy. One drained a researcher's Ethereum wallet. A single leaked key, run through the same decoy mesh, generated 100 million tokens and leaked 99 credentials across 440 downstream agent sessions, 91% of which had tool auto-approval switched on. Six weeks earlier, on March 24, 2026, someone calling themselves TeamPCP compromised a scanner wired into LiteLLM's own CI pipeline, stole its PyPI publishing tokens, and shipped a backdoored release to roughly 40,000 downloads before PyPI quarantined the package 90 minutes later. Both stories are the same infrastructure component, studied two different ways: a router has to read every prompt, tool call, and provider key in plaintext to do its job. Here's what the research found, what actually defended against it, and the checklist for auditing whatever sits in that position in your own stack, including us.

Published 2026-08-07 by Dor Amir on the Nadir blog.

Filed under Routing & Cascades.

Two stories, six weeks apart, about the same piece of infrastructure.

On April 9, 2026, a team from UC Santa Barbara published a measurement study most teams evaluating an LLM router have never seen. They bought 28 paid LLM API routers from Taobao, Xianyu, and Shopify storefronts, pulled 400 more free ones from GitHub and public developer communities, and ran all 428 through live and decoy traffic. Nine of them actively rewrote payloads in transit, one swapping a legitimate package-installer URL for an attacker-controlled script mid-request. Seventeen reached into a planted AWS credential the moment it crossed their proxy. One drained a researcher's Ethereum wallet from a private key that was never supposed to leave the request. Source: Liu, Shou, Wen, Chen, Fang, and Feng, "Your Agent Is Mine: Measuring Malicious Intermediary Attacks on the LLM Supply Chain," arXiv:2604.08407, April 9, 2026

Six weeks earlier, on March 24, 2026, someone using the handle "TeamPCP" compromised the Trivy security scanner wired into LiteLLM's own CI/CD pipeline, used it to exfiltrate the project's PyPI publishing tokens, and pushed two backdoored releases, versions 1.82.7 and 1.82.8, straight into a package that pulls roughly 95 million downloads a month. The backdoor ran in three stages: harvest every AI provider key and cloud credential it could find, attempt lateral movement inside any reachable Kubernetes cluster, and install a persistent systemd service for command-and-control. Security researcher Callum McMahon flagged a crash at 11:48 AM caused by a fork-bomb side effect; the attacker tried to suppress the report by closing the GitHub issue at 12:44 PM; PyPI administrators quarantined the whole package at 1:38 PM. Roughly 40,000 downloads happened in the window before that. Source: Cycode, "Shedding The Lite: Unfolding The Dramatic Turn of Events With the LiteLLM Compromise," March 2026

These are not two unrelated security incidents. They're the same component of the stack, studied two different ways: an LLM router, the thing that sits between an application and a model provider deciding where each request goes, has to read every prompt, every tool call, and every provider API key in plaintext to do its job. That's not a bug in a specific router. It's the job description.

Why a router is the one thing in your stack that sees everything.

A router's entire function requires plaintext visibility: it reads the request to decide which model or provider handles it, and it reads provider credentials to make the call on your behalf. A reverse proxy in front of a web app can be zero-knowledge about the payload it forwards. An LLM router structurally cannot be, unless it's built specifically to avoid that. A March 2026 IETF-adjacent research note from the Cloud Security Alliance put it plainly: a compromised proxy in this position can simultaneously exfiltrate LLM provider keys, cloud credentials across AWS, GCP, and Azure, Kubernetes service tokens, SSH keys, git credentials, and cryptocurrency wallet files, because all of it routinely passes through the same plaintext channel on the way to a model call. Source: Cloud Security Alliance, "LLM Proxy Router Risk," Research Note, April 16, 2026

Two-panel chart. Left panel: of 428 LLM API routers tested by a UC Santa Barbara study, 9 injected malicious code, 17 accessed decoy AWS credentials, and 1 drained a live crypto wallet. Right panel: a single leaked API key generated 100 million tokens and leaked 99 distinct credentials across 440 downstream agent sessions, 401 of which (91%) ran with tool auto-approval turned on.
Two-panel chart. Left panel: of 428 LLM API routers tested by a UC Santa Barbara study, 9 injected malicious code, 17 accessed decoy AWS credentials, and 1 drained a live crypto wallet. Right panel: a single leaked API key generated 100 million tokens and leaked 99 distinct credentials across 440 downstream agent sessions, 401 of which (91%) ran with tool auto-approval turned on.

The UC Santa Barbara paper catalogs four distinct attack classes a malicious router can run once it has that visibility, and the poisoning experiment attached to it shows how fast the damage compounds once one goes live:

The researchers then ran a single leaked OpenAI key through their own decoy mesh to see how far one exposed credential travels. It generated 100 million GPT-5.4 tokens across seven Codex sessions before anyone acted on it. Twenty decoy routers logged more than 147,000 unauthorized access attempts. Across 440 downstream agent sessions touched by the leak, 99 distinct credentials were exposed, and 401 of those 440 sessions, 91%, were running with tool-call auto-approval turned on, meaning nothing in the loop was checking what the router handed back before the agent acted on it.

The defense that actually held up, and the one that's coming.

The same paper didn't just measure the attack surface, it tested three defenses against it. A fail-closed policy gateway blocked payload and dependency injection outright, at a 1% false-positive rate. Behavioral anomaly detection caught 89% of injection attempts, at a 6.7% false-positive cost. Append-only logging added forensic traceability at roughly 1.26KB per entry. All three help. None of them close the underlying gap, because all three still require the router to hand you accurate information about itself, and a sufficiently patient conditional trigger can wait out a detector tuned to catch fast, obvious tampering.

A companion paper published two months later goes after the structural fix instead of a better detector. "The Proxy Knows Too Much: Sealing LLM API Routers With Attested TEEs" proposes AEGIS, running the router inside a hardware-attested trusted execution environment so that even the operator of the routing service cannot read the plaintext passing through it, and reports that this blocks all four attack classes from the first paper, not by detecting them better, but by removing the plaintext visibility the attacks depend on. Source: "The Proxy Knows Too Much: Sealing LLM API Routers with Attested TEEs," arXiv:2606.16358, June 2026 That's the honest state of the field right now: detection is real and worth deploying, but the paper that actually closes the gap is a June 2026 research proposal, not a shipped product every router on the market has adopted.

What to actually check before you trust a router with your keys.

SignalWhat it tells youWhy it matters
Corporate identity, published security docs, disclosure processWhether there's anyone accountable if something goes wrongThe UC Santa Barbara sample skewed toward anonymous marketplace sellers on Taobao, Xianyu, and gray-market Telegram channels, exactly the profile with nothing to lose from a bad actor operating it
Where the routing engine actually runsWhether your prompts and provider keys leave your network boundary at allA router that runs inside your own VPC against your own provider keys has no third-party plaintext path to compromise in the first place
CI/CD signing, SBOM, pinned dependency hashesWhether a supply-chain compromise like TeamPCP's can reach you silently through an auto-upgradeLiteLLM's compromise didn't require any user to do anything wrong; it moved through the project's own build pipeline into an ordinary version bump
Tool-call auto-approval defaultsWhether a compromised or tampered router response gets acted on without review91% of the poisoned sessions in the study had auto-approval on; it was the single largest amplifier of damage across the whole experiment
Whether the routing decision itself is auditableWhether you can tell a legitimate model swap from an injected one after the factAppend-only, tamper-evident logging caught issues the other two defenses missed, at a real but modest storage cost

None of this is a reason to route every model call through hand-written, unaudited glue code instead. Direct SDK calls to a single provider dodge the multi-hop risk entirely but give up everything a router buys you: cost-aware model selection, failover when a provider has an outage, a single interface across a fleet of models. The fix isn't avoiding routers, most teams running more than one model genuinely need one, it's treating the choice of router with the same scrutiny you'd apply to picking an identity provider or a payments processor, because it now sits in a structurally equivalent position: the one component with plaintext access to your most sensitive traffic and your credentials for everything downstream of it.

What to ship this week.

Conclusion.

Cost has been the framing for almost everything written about LLM routing this year, which model to escalate to, which cache to keep warm, which price cut actually reaches the bill. The UC Santa Barbara study and the LiteLLM compromise are a reminder that a router's cost function and its trust function are two separate problems, and the second one has gotten almost no attention because most of the routing conversation in 2026 has been about savings. Nine malicious routers out of 428 tested is a small percentage. Ninety-five million monthly downloads exposed to a supply-chain compromise for roughly ninety minutes is not a small number, and the mechanism that made both possible is identical: something in your stack has plaintext access to every prompt, tool call, and provider key you send it, and almost nobody asks who operates that thing or what happens if it's wrong before they wire it in.

Related reading.


Sources: [Liu, Shou, Wen, Chen, Fang, and Feng, "Your Agent Is Mine: Measuring Malicious Intermediary Attacks on the LLM Supply Chain," arXiv:2604.08407, April 9, 2026](https://arxiv.org/abs/2604.08407). ["The Proxy Knows Too Much: Sealing LLM API Routers with Attested TEEs," arXiv:2606.16358, June 2026](https://arxiv.org/abs/2606.16358). [Cycode, "Shedding The Lite: Unfolding The Dramatic Turn of Events With the LiteLLM Compromise," March 2026](https://cycode.com/blog/lite-llm-supply-chain-attack/). [Cloud Security Alliance, "LLM Proxy Router Risk," Research Note, April 16, 2026](https://labs.cloudsecurityalliance.org/research/csa-research-note-llm-proxy-router-risk-20260416-csa-styled/).

More on routing & cascades

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.