AttriGuard: Defeating Indirect Prompt Injection in LLM Agents via Causal Attribution of Tool Invocations

Yu He, Haozhe Zhu, Yiming Li, Shuo Shao, Hongwei Yao, Zhihao Liu, Zhan QinarXiv 2026

TL;DR

AttriGuard introduces a novel defense paradigm called action-level causal attribution to protect LLM agents from Indirect Prompt Injection (IPI). Instead of trying to detect malicious text patterns in external data, AttriGuard runs a parallel counterfactual test using sanitized data to verify whether a proposed tool call is genuinely driven by the user's intent. It achieves a 0% attack success rate against static attacks with negligible impact on agent utility and robust resilience against adaptive adversaries.

What Problem Does This Paper Address?

LLM agents have evolved from passive chatbots into autonomous systems capable of executing multi-round workflows using external tools (e.g., browsing the web, reading emails, or managing databases). However, this autonomy introduces a severe vulnerability: Indirect Prompt Injection (IPI). In an IPI attack, an adversary hides malicious instructions inside untrusted external content that the agent is bound to read. If the agent fails to separate data from instructions, it might execute unauthorized actions, such as exfiltrating sensitive user data or triggering fraudulent financial transactions.

Most existing defenses treat IPI as a semantic discrimination problem—essentially trying to classify whether the incoming text looks "suspicious" or matches known malicious templates (like "Ignore previous instructions"). The authors argue that this input-centric framing is fundamentally brittle because natural language is highly non-linear; attackers can easily bypass filters by framing malicious payloads as routine workflows. System-level alternatives that isolate the agent entirely from external data during planning solve the security issue but severely degrade the agent's ability to handle complex, real-world tasks.

Methods

The authors propose shifting the defensive focus from what the untrusted text contains to why the agent is executing a specific action. This concept is instantiated in AttriGuard, a runtime defense system that gates tool calls using parallel counterfactual testing.

Figure 1: AttriGuard pipeline under injected vs. benign observations. Left (with IPI): the original run (top) retrieves an injected webpage and invokes a malicious messaging call; the shadow run (bottom) syncs history, attenuates the control potency, and the fuzzy survival test blocks the injected call. Right (benign): both runs agree on the save-to-pad call, which is executed.

When a base agent proposes a tool call, AttriGuard intercepts it and performs the following three-step verification process in a parallel "shadow" branch:

  1. Teacher-Forced Shadow Replay: To determine if the tool call is driven by the user or the untrusted data, AttriGuard re-executes the agent prompt. To prevent the shadow trajectory from drifting due to LLM stochasticity, it forces the shadow run to replay the exact history of past actions verbatim.
  2. Hierarchical Control Attenuation: The shadow run is fed a modified, "attenuated" version of the external observations. AttriGuard uses an auxiliary LLM to rewrite the text, stripping away its "control channels"—such as executable structures (JSON/HTML formatting), directive perspectives (second-person commands), and persuasive causal scaffolding—while preserving the raw informational facts.
  3. Fuzzy Survival Criterion: If the proposed tool call still appears (survives) in the shadow run despite the data losing its commanding force, it is deemed intent-supported and allowed to execute. If it vanishes or changes drastically, it is flagged as observation-driven (an IPI attack) and blocked. AttriGuard uses a flexible matching system (including an LLM judge for borderline cases) to tolerate benign argument variations while remaining sensitive to malicious manipulation.

Datasets

The authors evaluated AttriGuard across four prominent LLMs (Gemini-2.5 Flash, GPT-4.1-mini, Qwen3-32B, and Llama3.3-70B) using two primary benchmarks:

  • AgentDojo: A high-fidelity benchmark simulating realistic agent interactions across four suites: workspace, Slack, travel, and banking.
  • Agent Security Bench (ASB): A supplementary benchmark used to evaluate the generalizability of the defense across a broader, more diverse set of tool-use environments.

Key Insights and Ideas

  • Causal Roots of Actions: The core "aha moment" is that benign and malicious actions originate from fundamentally different causal processes. In a legitimate workflow, the user's prompt provides the control, and external data merely fills in parameters. In an attack, the external data must exert a strong control effect to hijack the agent's flow.
  • Verification vs. Execution Isolation: Instead of forcing the agent to execute directly on heavily sanitized data (which ruins performance because critical parameters get lost), AttriGuard isolates the sanitization to a verification branch. The main branch still enjoys full-fidelity data, maintaining high utility.
  • Resilience to Optimization: Because AttriGuard targets a fundamental causal property rather than surface-level text patterns, automated optimization tools (like genetic algorithms used by advanced red teams) struggle to generate payloads that can bypass the defense.

Key Results

  • 0% Attack Success Rate (ASR): Under static attacks across all four LLMs on the AgentDojo benchmark, AttriGuard completely neutralized the threats, bringing the ASR down to 0%.
  • Negligible Utility Loss: AttriGuard maintained benign utility with an average degradation of only ~3%. In comparison, the state-of-the-art isolation defense (CaMeL) suffered a massive ~20% utility drop.
  • Robustness Against Adaptive Attacks: When subjected to an optimization-based adaptive stress test (up to 500 queries), AttriGuard maintained single-digit ASRs (6.56% on Gemini, 9.84% on Llama). Meanwhile, other leading defenses collapsed, with ASRs spiking between 29.5% and 82.0%.
  • Moderate Overhead: AttriGuard introduces a ~3× increase in latency. On open-weights models like Llama, token usage doubled due to the shadow replay, but on proprietary models like Gemini, token usage remained close to the baseline because AttriGuard blocks malicious multi-step trajectories early before they waste tokens.

Limitations and Future Work

  • Long-Horizon False Positives: On highly dynamic, long-turn tasks, minor variations caused by model stochasticity or formatting can accumulate, leading AttriGuard to falsely block legitimate actions. The authors suggest that in production, hard blocking could be replaced with a lightweight user confirmation prompt.
  • Dependency on Auxiliary Models: The effectiveness of the control attenuation step relies on the prompt-following capabilities of the auxiliary LLM used to rewrite the data.
  • Workflows with Heavy Delegation: If a user explicitly authorizes an agent to follow instructions from a file (e.g., "run the commands listed in this email"), the boundary of causal attribution blurs, as the action becomes technically intent-supported.
  • Non-Natural-Language Schemas: In code-only or highly structured environments, separating data from control signals is intrinsically harder, highlighting a need for future "schema-aware" attenuation operators.

Summary updated

BibTeX
@misc{he2026attriguard,
  author = {Yu He and Haozhe Zhu and Yiming Li and Shuo Shao and Hongwei Yao and Zhihao Liu and Zhan Qin},
  title = {{AttriGuard: Defeating Indirect Prompt Injection in LLM Agents via Causal Attribution of Tool Invocations}},
  year = {2026},
  eprint = {2603.10749},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.10749},
}
Figure