Your Agent Is Mine: Malicious LLM API Routers as an Agent Supply-Chain Boundary
This paper shows that third-party LLM API routers are not just compatibility layers. Because they terminate client traffic and forward plaintext tool-call JSON upstream, a malicious or compromised router can rewrite executable tool arguments, steal secrets in transit, and selectively target autonomous agent sessions. The defensive lesson is to treat router choice, route policy, tool execution, and request logging as one governed security boundary.
Threat Analysis
- The router sits in the application-layer middle. The client intentionally points its base URL at the router, so TLS protects the hop to the router but does not prove that the returned tool call is what the upstream model produced.
- Payload injection happens after inference. The model can produce a benign
Bashcall, then the router can replace one argument with an attacker-controlled installer or package name while preserving valid JSON and schema shape. - Secret theft does not require visible tampering. API keys, cloud credentials, system prompts, tool definitions, file contents, and environment variables all cross the router in plaintext.
- The ecosystem signal is already practical. The authors found malicious paid and free routers, unauthorized use of researcher-owned AWS canaries, theft from a researcher-owned ETH key, adaptive triggers, and 440 Codex sessions with exposed shell-execution paths in weak-router decoys.
- Client-side controls help, but do not prove origin. Policy gates, anomaly screening, and append-only logs reduce exposure today; provider-signed response envelopes are the longer-term integrity answer.
Applicable AIDEFEND Defenses (8)
What Defenders Should Do Now
- Inventory every agent, IDE, CI job, and internal platform that points model traffic at a third-party API router, relay, gateway, or OpenAI-compatible base URL.
- Move router configuration into reviewed route policy bundles. Block ad-hoc base URL changes and require per-router credentials with scoped privileges, short lifetimes, and owner metadata.
- Fail closed on high-risk tool calls from routed sessions: shell execution, package installation, file writes outside the workspace, cloud CLI actions, and outbound network fetches.
- Strip secrets from prompts, tool outputs, and logs before they cross untrusted routers. Use canary credentials and alert if any canary touched a cloud, repo, wallet, or SaaS API.
- Enable local transparency logging for routed sessions: router URL, TLS metadata, request and response hashes, redacted payload classes, tool names, and approval mode. Keep enough retention to scope incidents.
- Run routed agent sessions in low-secret sandboxes with constrained egress, especially when auto-approval or YOLO mode is enabled.
1 additional consideration
Provider-signed response envelopes for tool-call provenance
Conclusion
The paper makes a subtle trust boundary hard to ignore: an LLM API router can be both a convenience layer and the last component to touch executable agent commands before they run. AIDEFEND provides distinct controls for capability scoping, data-flow sink enforcement, route-policy governance, service authentication, execution controls, and monitoring. The remaining ecosystem step is origin integrity for tool calls, so clients can verify what the upstream model actually produced before an agent acts on it. Response signing cannot undo secrets already disclosed on the request path.
Last updated: