CausalArmor: Efficient Indirect Prompt Injection Guardrails via Causal AttributionCausalArmor: Efficient Indirect Prompt Injection Guardrails via Causal Attribution
CausalArmor sanitizes only when untrusted segments dominate privileged actions; the authors state its ASR is near zero and benign latency is close to no defense.
Indirect prompt injection: the attacker hides content with instructions in untrusted segments such as web pages, emails, or tool outputs, inducing a tool-calling agent to execute unauthorized privileged actions such as write, send, execute. In DoomArena, the attacker can also eavesdrop on conversations and rewrite the database. The paper does not use white-box, black-box, or gray-box to describe attacker knowledge.
- When tool-calling agents read web pages, emails, or tool outputs, they may be induced by indirect prompt injection to perform unauthorized privileged actions. Always-on cleaning or step-by-step verification can reduce the attack success rate, but they also reduce utility and increase latency when there is no attack.
- When a privileged action is proposed, CausalArmor uses a smaller surrogate model to perform length-normalized leave-one-out attribution. Only when an untrusted segment outweighs the user request by more than the margin is that segment cleaned, subsequent assistant reasoning is masked, and the action is regenerated.
- In Table 3 of AgentDojo, CausalArmor's ASR is 0.0%–0.62%. Gemini-3-Pro on DoomArena is 3.65% (±0.73), with no defense at 88.87% (±1.67).
- The authors note that LOO deletion is not a full structural causal model; when the influence is spread across multiple segments, it may not exceed the threshold, and the upper bound depends on the cleaner. The experiments include TauBench-Retail with three table backbones and DoomArena; the main text states that Gemini-2.5-Pro was evaluated, but Table 3 does not list it.
- Evaluated models
- Gemini-2.5-flashClaude-4.0-SonnetGemini-3-Pro
- Benchmarks
- AgentDojoDoomArena(TauBench-Retail)
- Metrics
- ASRBUBLUALA
The paper proposes CausalArmor, a selective defense framework against indirect prompt injection for tool-calling agents, which triggers sanitization only when untrusted segments dominate decisions. The method starts from a causal ablation perspective, computing lightweight leave-one-out ablation-based attributions at privileged decision points, and initiates targeted sanitization only when untrusted segments such as retrieved documents or tool outputs outweigh user intent, and uses retrospective chain-of-thought masking to prevent the agent from acting on contaminated reasoning traces. The authors provide a theoretical analysis, claiming that under the conditions assumed in the analysis, sanitization based on attribution margins can push the upper bound on the probability of selecting malicious actions to exponentially small. Experiments on AgentDojo and DoomArena show that CausalArmor matches aggressive defenses in safety while preserving agent utility and latency.
Paper analysis
What problem does this paper attempt to solve?
Indirect prompt injection in tool-calling agents triggers unauthorized privileged actions, while always-on sanitization harms benign utility and latency.
When tool-calling agents read untrusted content, they may be induced by indirect prompt injection to perform unauthorized privileged actions, while always-on defenses cause over-defense.
- Scenario: The authors state that agents can browse web pages, query external databases, and call APIs. Attackers hide content with instructions in web pages, emails, or tool outputs, causing the agent to perform privileged actions such as writing files, sending messages, or exfiltrating data.
- Existing Shortcomings: The authors state that many defenses continuously clean all new context, add policy gates, or run expensive verification step by step. They can reduce attack success rates, but in common deployments without attacks, they also reduce benign utility and increase latency.
- Core Observation: The authors state that a successful injection is a dominant shift at a privileged decision: the user request no longer provides decisive support, and the ablation attribution of some untrusted segment is disproportionately high.
- Proposed in This Paper: CausalArmor performs lightweight leave-one-out attribution at privileged decision points, cleans a segment only when an untrusted segment outweighs user intent by a given margin, and retroactively masks the contaminated reasoning trace.
- Threat Model:
- Goal: Make the agent perform unauthorized privileged actions, not merely place malicious text in the context.
- Input: The attacker controls external content the agent will read, planting segments with instructions. The paper does not use white-box, black-box, or gray-box to describe attacker knowledge.
- Victim System: An LLM agent that can call tools. Privileged tools include execute, write, send, and user-defined critical operations.
- Stronger Setting: The DoomArena attacker is privileged and adaptive, able to eavesdrop on the user-agent conversation and rewrite the database in real time.
What related research exists?
Related work is divided into IPI and benchmarks, three types of defenses, and LOO attribution; the authors position this paper as on-demand triggering of expensive sanitization.
Indirect Prompt Injection and Evaluation
- Willison (2022), Perez and Ribeiro (2022), Willison (2023): Externally retrieved content is treated simultaneously as data and potential instructions, which can hijack control flow or escalate to harmful tool calls.
- Debenedetti et al. (2024): In long-horizon interactions, injected intent can propagate across turns through memory and repeated tool calls.
- Evaluation Environments: AgentDojo, DoomArena, InjecAgent (Zhan et al., 2024), and Agent Security Bench (Zhang et al., 2024a) are used to evaluate IPI defenses over long horizons and multiple domains.
Three Classes of Defenses
- Prompts: Schulhoff (2023) repeats user intent, and Hines et al. (2024) append policy reminders that treat tool outputs as untrusted. The authors state that these methods are cheap but fragile under adaptive phrasing, and rarely hold security across templates and domains when used alone.
- Trained Classifiers: Kim et al. (2024) and Li et al. (2025b) detect and mask injections. The authors state that they face out-of-distribution phrasing, deletion of task-relevant information, and distribution shift across domains and tool formats; if every tool output is cleaned, this reverts to always-on costs (Shi et al., 2025b).
- System Constraints: CaMeL separates and constrains the instruction and data channels, which the authors state has conceptual guarantees. DRIFT first generates a plan and constraints from the user request, then executes and cleans tool outputs each turn. MELON compares decisions with and without the user request to detect anomalies. Other work uses LLMs to clean all tool outputs. The authors state that conservative control or multiple LLM calls per turn can limit capability and increase latency.
Attribution
- LOO: Relative to gradient saliency (Adebayo et al., 2018) and perturbation methods (Chattopadhyay et al., 2019), Cohen-Wang et al. (2024) use leave-one-out to quantify the effect of deleting a segment on the output distribution.
- Existing Uses: Judging whether generation is supported by retrieved context, and the model's reliance or mis-reliance on context (Liu et al., 2024; Tsai et al., 2023; Tutek et al., 2025; Zhang et al., 2024b). The authors state that a successful IPI produces a causal reversal measurable with LOO.
Experimental Baselines and Benchmarks
- Baselines: Repeat Prompt, DeBERTa Detector, PiGuard, MELON, DRIFT; Table 3 also reports PromptArmor. The cleaner is fixed to Gemini-2.5-flash, and the attribution agent is Gemma-3-12B-IT.
- Benchmarks: AgentDojo (629 injection tasks) and TauBench-Retail from DoomArena (115 tasks).
The authors position CausalArmor as deciding when and where to pay for expensive cleaning: only at privileged decision points does it detect a dominant shift from untrusted segments relative to the user request, rather than cleaning all untrusted content or continuously verifying.
How does the paper address this problem?
At privileged actions, a surrogate model performs normalized LOO attribution; only when the margin exceeds the threshold is the corresponding segment cleaned and subsequent chain of thought masked.
CausalArmor is an intermediate layer placed before the agent: it first isolates untrusted segments, computes attributions only when a privileged action is proposed, and then decides whether to sanitize.
Setting and dominance shift
- The context at step t is written as user request U, trusted system-side context H_t, and untrusted segment set S_t. In the implementation, each segment corresponds to a tool result from one turn, not necessarily a whole document.
- Candidate actions are divided into privileged tools and non-privileged tools. The paper focuses on preventing unauthorized privileged actions, and states that users can customize the list of actions to protect.
- The leave-one-out attribution for component X and candidate action Y is ΔX(Y;Ct):=log P(Y|Ct)−log P(Y|Ct∖ X), i.e., the marginal support of X for selecting Y. P can be the agent's next-action distribution, or the proxy in Section 4.1.
- The authors state that in benign cases the user request's attribution is higher than each untrusted segment; in successful IPI, some segment's attribution for the malicious privileged action is much higher than the user request's, and the user attribution is often close to 0. Figure 2 summarizes this comparison on AgentDojo; the text does not give the scores in the figure.
Margin detection
- Detection occurs only when the proposed action belongs to the privileged set and untrusted segments exist. If a segment's normalized attribution is higher than the user request attribution minus margin τ, it enters the suspicious set.
- τ=0 corresponds to a pure causal reversal test; τ tending to negative infinity means never sanitizing; τ tending to positive infinity approaches always-on sanitization. Figure 4 marks the default CausalArmor as τ=0.
- The authors state that they do not treat "low user attribution" alone as an attack signal, because benign capability failures also reduce user support, but not necessarily forming a spike on some untrusted segment.
Two-stage intervention
- Selective sanitization: calls a sanitization model on suspicious segments, which in experiments is Gemini-2.5-flash, conditioned on the user request and the definition of that privileged tool. The authors state this helps distinguish instructions driving unauthorized calls from facts that still need to be preserved. Appendix D.1 gives the full prompt.
- Retrospective chain-of-thought masking: from the first hit point onward, replace the assistant's reasoning with a generic placeholder, then let the agent regenerate the action in the sanitized context. The authors state that only removing input while leaving reasoning that has accepted the injection may cause the malicious action to be repeated during regeneration.
- When not triggered, the original action is executed directly. Algorithm 1 is a simplified flow; Algorithm 2 gives the complete steps for batch scoring, replacement, masking, and regeneration.
Batch attribution and normalization
- Each ablation context is independent and forms a batch with the full context, and a smaller proxy model gives log probabilities in one forward pass. The example in the text is Gemma-3-12B-IT served via vLLM. The authors state that some APIs do not support log-probability scoring for frontier models.
- The authors cite cross-model transferability from Liu et al. (2024), and in Section 5.5 use end-to-end attack success rate to test whether the proxy is sufficient.
- Attribution is divided by the token length of the candidate action, so that τ does not scale with the length of chain-of-thought and tool-call strings.
Theoretical bound
- Assumption 1: after removing the injection trigger, the user-aligned action has a positive log-probability margin β relative to the malicious privileged action.
- Assumption 2: the sanitized untrusted content's marginal support for the malicious privileged action is at least γ lower than for the user-aligned action.
- Proposition 4.1 states that under these two assumptions, the upper bound on the probability of executing any malicious privileged action in a round of length T is T·|Y_{mal}|·exp(−(β+γ)). The authors state that increasing τ enlarges the sanitized set, making it more likely that γ is positive. The proof is in Appendix B.
What experiments did the paper conduct?
On AgentDojo, CausalArmor's ASR is 0.0%–0.62% (Table 3).
Experimental Setup
- Backbones: Default Gemini-2.5-flash. Table 3 and Figure 3 also report Claude-4-Sonnet and Gemini-3-Pro. Section 5.1 additionally states that Gemini-2.5-Pro was evaluated, but this name does not appear in Table 3.
- Shared Components: The cleaner for each baseline is fixed to Gemini-2.5-flash, and the attribution agent defaults to Gemma-3-12B-IT.
- AgentDojo: Four categories—banking, slack, travel, workspace—with 70 tools and 629 injection tasks. In addition to important_instructions, there are task_dependency and tool_output_hijack designed by Gemini-3-Pro. The two other columns in the table are labeled New Attack 1 and New Attack 2, and the paper does not specify the correspondence with these two template names. The paper does not report the number of repetitions for this benchmark.
- DoomArena: TauBench-Retail, 115 tasks, 5 random seeds. Both the attacker and user simulators are Gemini-2.5-flash; the attacker can eavesdrop on the conversation and rewrite the database. The authors state that CaMeL, DRIFT, and MELON cannot be applied in the conversational setting.
- Baselines: Repeat Prompt, DeBERTa Detector, PiGuard, DRIFT, MELON; Table 3 also includes PromptArmor.
- Metrics: BU is the benign goal success rate without attack; BL is the benign wall-clock overhead, shown relative to no defense in the table, where no defense is 1.00; UA is the ability to complete tasks under attack; ASR is the proportion of tasks where IPI successfully manipulates behavior. Table 3 also reports latency under attack, LA. The paper states that latency under attack was recorded, but uses BL as the primary efficiency metric. The paper does not mention LLM review or human agreement.
Main Results
Swipe horizontally to read the table
Backbone and Method BU BL ASR for II UA for II Gemini-2.5-Flash / No Defense 53.61 1.00 32.47 32.46 Gemini-2.5-Flash / CausalArmor 56.26 1.30 0.62 50.90 Claude-4-Sonnet / No Defense 89.44 1.00 2.32 83.98 Claude-4-Sonnet / CausalArmor 82.47 1.27 0.0 83.67 Gemini-3-Pro / No Defense 92.78 1.00 5.06 90.41 Gemini-3-Pro / CausalArmor 86.60 1.22 0.11 87.14 According to Table 3. II is Important Instructions. BU, UA, and ASR are listed according to the values in the table; BL is relative to no defense.
- The authors state that in Figure 3, CausalArmor reduces ASR to near zero, with UA and benign overhead close to no defense. In Table 3, the BU for Claude-4-Sonnet and Gemini-3-Pro is lower than their respective no-defense values; the UA for Flash in the II scenario is higher than no defense.
- In the same table, CausalArmor's ASR on New Attack 1/2: Flash is 0.42 and 0.40, Claude is 0.11 and 0.46, and Gemini-3-Pro is 0.11 and 0.0. The corresponding no-defense values are 12.01/7.06, 3.37/18.97, and 5.69/8.85.
- Not every cell is lower than all baselines. On Flash's New Attack 2, PiGuard's ASR is 0.0, while CausalArmor's is 0.40; PiGuard's BU is 32.99. On Claude's II, PromptArmor's ASR is 0.0, with a BL of 2.20.
DoomArena Adaptive Attacks
- Table 1 only reports Gemini-3-Pro. The no-defense ASR is 88.87 (±1.67), BU is 73.57 (±1.32), and BL is 1.00 (±0.01). CausalArmor's ASR is 3.65 (±0.73), BU is 70.96 (±0.99), and BL is 1.38 (±0.04).
- Repeat Prompt's ASR is 72.70 (±2.65), and BU is 65.04 (±3.33). PiGuard's ASR is 5.57 (±0.48), and BU is 55.13 (±2.35).
- The authors state that the classifier over-defends by intercepting context indiscriminately, while CausalArmor reduces ASR and maintains higher BU in this setting. Appendix C.3 also states a no-defense ASR of 89.47%, which is inconsistent with the 88.87 in Table 1; the table is taken as authoritative here. The appendix states that the attacker can delete information needed to complete the original task, so UA for all methods tends toward 0, and this table does not report UA.
Chain-of-Thought Masking and Surrogate Models
- Table 2 averages across all experimental scenarios: CausalArmor's BU is 75.11 and ASR is 0.29; without CoT masking, BU is 74.61 and ASR is 1.75. The authors state that ASR increases by 1.46 percentage points and BU decreases by 0.5 percentage points, and that residual contaminated reasoning can act as a false anchor during regeneration. Appendix E.2 uses a case study to show that cleaning only the input may still lead to re-executing malicious privileged actions.
- Figure 5 uses Gemini-3-Pro as the backbone, varying agents from the Gemma-3, Qwen3, and Ministral families at different scales. The authors state that models larger than 8B can identify most IPI, and defense rates approach the oracle beyond 12B; the Gemma family is closer to the Pareto-optimal frontier of latency and safety relative to other families. The figure marks scales such as 1B, 1.7B, 3B, 4B, 8B, 12B, 14B, 27B, and 32B, but the main text does not give the ASR for each point. The authors state that closed-source APIs typically do not support the log probabilities needed to compute oracle LOO at scale, so end-to-end ASR and relative latency are used for functional validation.
Margins and Hypotheses
- Section 5.3 and Figure 4 compare Always-on, No Def, and different τ. The authors state that the default τ=0 already reduces ASR to near zero while largely preserving benign utility and latency; increasing τ is stricter and has little effect on benign utility. The figure caption does not specify the backbone. The vertical axis ASR goes to about 0.10, and relative benign latency goes to about 2.4; the main text does not give coordinates for each point. Figure 6 repeats this trade-off on Gemini-2.5-flash, Claude-4-Sonnet, and Gemini-3-Pro, and the main text likewise does not give values for each point.
- Section 5.6 uses BU without attack (Table 3) to support Hypothesis 1. Figure 7 shows LOO box plots for Gemini-2.5-flash on AgentDojo before and after cleaning; the authors state that after cleaning, attribution to injected segments is suppressed and user requests dominate recovery, and that this figure does not directly estimate γ for each malicious action.
Other Ablations and Analyses
- On Flash, Repeat Prompt's BU is 64.95, higher than the no-defense 53.61; its ASR for II is 35.93, higher than the no-defense 32.47 (Table 3).
- DRIFT's BL across the three backbones is 4.67, 5.43, and 5.82. MELON is 2.21 and 2.31 on Flash and Claude; Table 3 for Gemini-3-Pro does not report MELON.
- On Flash, CausalArmor's LA for II, New Attack 1, and New Attack 2 is 1.96, 1.78, and 1.81, while no defense is 1.00 for all (Table 3).
- Appendix E.1: The authors state that multi-turn, fragmented injections still form a causal bottleneck at privileged calls; Table 4 gives examples for travel, banking, and workspace targets. The appendix provides examples, and the main text does not report additional ASR.
- The Pearson correlation of 0.94 from Liu et al. (2024) is a cited result, not a correlation measured in this paper.
What are some points that can be further explored?
The authors point out that LOO is not a full structural causal model, and the guarantees are conditional when distributed attacks and sanitizer failures occur.
Limitations and future directions noted by the authors
- Operational causality (Appendix A): measuring with deleted segments captures counterfactual influence on the next privileged action, not a full structural causal model. Future work could study semantics-preserving interventions, or interactions that appear only when multiple segments are changed together.
- Fragment attacks (Appendix A): in theory, causal influence could be spread thin so that no single segment exceeds τ. The authors state that constructing such attacks in natural language is not easy; future work could use set attribution methods such as approximate Shapley.
- Scrubber (Appendix A): the framework chooses when and where to trigger defenses, and does not propose a new scrubbing model; effectiveness varies with the chosen scrubber. The authors do not claim that current scrubbers can handle all future obfuscations or distribution shifts. When many steps are flagged, overhead can approach always-on scrubbing.
- Modality and dependencies (Section 6): future work could extend to multimodal contexts and improve attribution to better capture complex causal dependencies.
Experimental coverage
- Backbones with result tables are Gemini-2.5-Flash, Claude-4-Sonnet, Gemini-3-Pro (Table 3, Figure 3). Section 5.1 also states that Gemini-2.5-Pro was evaluated; Table 3 does not list that name.
- AgentDojo includes four environment types, 70 tools, 629 injection tasks, and three injection templates. The DoomArena experiment uses 115 tasks from TauBench-Retail with 5 seeds (Section 5.1, Appendix C).
- AgentDojo comparisons include Repeat Prompt, DeBERTa Detector, PiGuard, DRIFT, MELON, and PromptArmor (Table 3); MELON is not reported for Gemini-3-Pro. DoomArena comparisons are Repeat Prompt and PiGuard (Table 1). The authors state that CaMeL, DRIFT, and MELON cannot be used in DoomArena due to the conversational setting.
- There are also ablations removing CoT masking (Table 2), τ values (Figure 4, Figure 6), and multi-scale agents Gemma-3, Qwen3, Ministral with Gemini-3-Pro as the backbone (Figure 5). The scrubber is fixed to Gemini-2.5-flash.
- The paper does not report the number of repetitions for AgentDojo, the exact ASR for each point in Figure 5, reviewer-human agreement, or the number of attack queries; latency is given as relative wall-clock time.
Summarize the main content of the paper
CausalArmor selectively sanitizes at privileged decisions based on attribution margins and masks the chain of thought, to mitigate over-defense in IPI.
CausalArmor is an indirect prompt injection defense middleware on tool-calling agents, used to avoid paying the utility and latency costs of always-on sanitization even when there is no attack.
- Problem: Instructions in web pages, emails, or tool outputs can push action probabilities toward unauthorized privileged actions. The authors view a successful injection as the user request losing attribution dominance, while some untrusted segment dominates that privileged decision.
- Method: Only when a privileged action is proposed, use a proxy model to compute leave-one-out attributions normalized by token length in batch. When a segment's attribution exceeds the user request minus a margin τ, sanitize that segment according to the user request and the tool definition, mask subsequent assistant reasoning, and regenerate the action. Figure 4 marks the default value as τ=0. Proposition 4.1 gives an exponential bound on the probability of malicious privileged actions when the backbone still has a positive benign margin and sanitization yields a positive intervention margin.
- AgentDojo: In Table 3, Gemini-2.5-Flash on Important Instructions goes from an ASR of 32.47 without defense to 0.62 with CausalArmor, BL from 1.00 to 1.30, BU from 53.61 to 56.26. Claude-4-Sonnet's corresponding ASR goes from 2.32 to 0.0, BU from 89.44 to 82.47. Gemini-3-Pro on New Attack 2 has a CausalArmor ASR of 0.0, and 0.11 on Important Instructions. In Table 3, CausalArmor's ASR across attack columns is 0.0–0.62.
- DoomArena: On Gemini-3-Pro, CausalArmor's ASR is 3.65 (±0.73), no defense is 88.87 (±1.67); BU is 70.96 (±0.99), no defense is 73.57 (±1.32) (Table 1).
- Authors' conclusion: The authors state that selective intervention based on dominance shifts can reduce ASR to near always-on defense levels while maintaining near-unprotected benign latency, and attribution indicates which segment the influence comes from. The authors also frame the probability bound as a conditional result depending on backbone capability and sanitization effectiveness, and state that future work can extend to multimodal and more complex causal dependencies.