AIDEFEND in Action AIA-0012 Incident Published: Apr 25, 2026

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.

Credential TheftTool Argument TamperingTool AuthorizationAgentic AIAPI Routers
8 applicable AIDEFEND defenses
Source: Your Agent Is Mine: Measuring Malicious Intermediary Attacks on the LLM Supply Chain 
Authors: Hanzhi Liu, Chaofan Shou, Hongbo Wen, Yanju Chen, Ryan Jingyang Fang, Yu Feng
Original article: Apr 9, 2026

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 Bash call, 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)

AID-H-018.004
Intent-Based Dynamic Capability Scoping
High
At the client-owned dispatcher, intersect subject and workload grants from the signed tool registry with the separately authenticated task’s requested scope, and enforce the resulting tool set, expiry and atomic action budget on every call. This can deny Bash or package-install tools that the task does not need. The published methods scope tool names; once a broad Bash tool is allowed, they do not validate its command, installer domain or package name. A separate argument policy and narrow tool design are required for those checks. The paper’s allowlist gate and its synthetic results are not an evaluation of this AIDEFEND method; its adaptive benchmark also demonstrated bypass through an allowed domain or a local stager.
AID-H-033.004
Route Policy Bundle Versioning, Approval, Canary & Rollback
High
Moving an agent to a third-party router can be as small as changing a base URL and API key. Treat those route policies as signed, reviewed, canaried security artifacts so teams cannot silently drift from approved providers into weak relay chains or untrusted compatibility endpoints.
AID-I-001.003
Ephemeral Single-Use Sandboxes for Tools
High
The study found many command-injectable sessions, most already running in auto-approve mode. Sandboxed tool execution, constrained network egress, and low-secret workspaces do not authenticate the tool call, but they sharply reduce damage if a malicious router changes what executes.
AID-H-004.002
Service & API Authentication
Medium
Use a distinct workload identity and bounded credential for each approved router or provider connection, and have the receiving service verify its issuer, audience, expiry and permitted route. This limits reuse across independently enforced services and the lifetime of an exposed key. Audience checks, OAuth or mTLS require support at that service; shortening a copied bearer key’s lifetime does not stop its use at the original service while it remains valid. An authenticated malicious router can still read traffic and rewrite returned tool calls. This control establishes service identity, not upstream response integrity or data-access authorization.
AID-H-025.001
Pre-Execution Static Analysis & Dangerous Construct Blocking
Medium
Apply the exact-artifact Semgrep gate in guidance G002 only after the final executable payload has been reconstructed and its complete target manifest, supported language and locally validated blocking rules are pinned. Bind the verdict to those bytes and the execution request, and recheck them before launch; unsupported targets, missing scans or errors deny execution. The Python AST gate in G001 is not a Bash-command scanner. Semgrep coverage must be established for this client’s shell or script surface; the published gate supplies no universal malicious-package detector and cannot inspect a remote installer merely by scanning its download command. Allowed-domain payloads, unrecognized constructs and local stagers remain risks, so retain separate execution isolation and package policy.
AID-H-018.005
Value-Level Capability Metadata & Data Flow Sink Enforcement
Medium
Passive router exfiltration is dangerous because secrets and high-sensitivity values ride through ordinary request and tool-output fields. Tracking value provenance and blocking unsafe transfers into external HTTP, shell, package, or logging sinks directly targets the AC-2 data-flow problem. This requires a controlled runtime with authenticated source/content bindings for every derived value, complete sink coverage and fail-closed unknown labels. One ingress label does not track arbitrary model rewriting. Native processes, browser requests and allowed destinations need separately verified coverage; stock SaaS deployment is not established.
AID-D-003.003
Agentic Tool Use & Action Policy Monitoring
Medium
Consume the actual authorization and schema-validation outcomes from the client’s tool-enforcement layer. Verify signed decision receipts, their freshness, policy version and exact proposal/action binding, then append and independently reconcile every allowed and denied terminal decision. Alert on verified denial bursts and validation failures using environment-specific policy. This requires a trusted receipt verifier and protected event sink; agent-supplied labels or ordinary request logs do not establish the decision. The paper’s IsolationForest screener scores returned tool-call features and is a different method. This mapping monitors enforcement outcomes; it does not classify arbitrary commands, authorize tools or block execution.
AID-D-005.004
Specialized Agent & Session Logging
Medium
Specialized agent and session logging answers, after suspicious activity, exactly which router, account, request, and tool call were exposed. Bind router URL, TLS metadata, request/response hashes, tool names, authenticated principal, and approval mode into append-only, privacy-preserving session records. This is especially important for AC-2, where traffic looks normal until a canary or stolen credential is used downstream.

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

Beyond the techniques mapped above, teams using LLM routers should also push for end-to-end response integrity: the upstream provider signs a canonical envelope covering model identity, tool name, tool arguments, finish reason, nonce, and validity window.
Recommendation: Until provider support exists, pair approved router policies with fail-closed tool gates, local transparency logs, and sandboxed execution. When response signing becomes available, require clients to verify the envelope before executing any tool call.

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: