- Rating
- 2
- Confidence
- 3
- Informativeness
- 2
- Presentation
- 3
- Soundness
- 2
Read review
Paper summary
This paper proposes SpanGuard, an indirect prompt injection (IPI) defense for LLM agents that decouples instruction localization from authorization. It segments tool outputs using semantic continuity and next-token NLL, then applies an LLM judge to identify instructions and determine whether they are authorized based on the user's request and provenance. Evaluations on AgentDojo compare SpanGuard with 13 baselines across two victim models, with additional ablations and adaptive-attack experiments.
Critical strengths
- Separating instruction localization from authorization reduces the context that the judge must analyze.
- The approach requires no victim-model retraining and incorporates provenance-aware authorization and conservative filtering.
- The paper compares 13 baselines and includes victim-model, guardrail-scale, and ablation studies.
Critical weaknesses
- Insufficient isolation of the core mechanism. The ablations do not establish whether semantic-continuity and NLL-based segmentation outperform simpler segmentation strategies. The whole-output ablation achieves zero ASR but only 19.59% utility, illustrating that low ASR alone does not demonstrate an effective defense. 2 Limited adaptive robustness evidence. The evaluation does not sufficiently test attacks that smooth semantic transitions or distribute instructions across blocks. SpanGuard also does not outperform every competing defense in all reported adaptive settings.
- Incomplete characterization of trade-offs and generalization. The fail-safe policy may remove legitimate content, while the evaluation provides limited insight into such false positives and focuses on AgentDojo's serialized tool outputs.
- Unclear end-to-end cost. Localization relies on Qwen2.5-7B for embeddings and NLL scoring. Without a component-level latency or cost breakdown, the practical extent of the lightweight advantage is difficult to assess.
Questions for authors
- Can you compare the proposed segmentation with sentence-level, fixed-size, and random contiguous segmentation while keeping the authorization and filtering procedures unchanged?
- How robust is SpanGuard against adaptive attacks that minimize semantic discontinuities or distribute a malicious instruction across multiple blocks?
- Can you quantify benign-content removal and its impact on task completion, and explain cases where utility under attack exceeds benign utility?
- How sensitive are the results to segmentation thresholds, and can you report latency and cost breakdowns for localization versus LLM-based judging?
6 comments
Q2: How robust is SpanGuard against adaptive attacks that minimize semantic discontinuities or distribute a malicious instruction across multiple blocks?
We introduce two targeted adaptive attack variants to challenge the two central components of SpanGuard:
- Smooth transitions: the attacker constructs payloads with smooth semantic transitions between benign and malicious sentences, aiming to evade localization.
- Fragmented instructions: the attacker distributes an injected instruction across multiple records, aiming to prevent the authorization judge from recognizing the complete malicious intent within individual blocks.
We evaluate these attacks using GPT-4.1-mini as the attacker. The results are shown in Table 2.
Table 2. SpanGuard's robustness against targeted adaptive attacks.
| Defense | Plain | Smooth | Fragmented |
|---|---|---|---|
| No defense | 64.5% | 74.2% | 51.6% |
| SpanGuard | 9.7% | 6.5% | 12.9% |
SpanGuard maintains low ASR under both targeted variants. Notably, smooth transitions do not increase ASR (6.5% vs. 9.7% in the plain setting). As demonstrated in Table 1, even when semantic boundaries are obscured, whole-output authorization can still identify the presence of injected instructions. Thus, disrupting segmentation alone does not suffice to evade SpanGuard, since the authorization judge can still recognize the attack at a coarser granularity. Fragmented instructions are more challenging, increasing ASR to 12.9%, although distributing instructions across separate records can also make them harder for the victim agent to interpret and execute. These results further demonstrate SpanGuard's robustness against attacks targeting its localization and authorization stages. This additional evaluation is included in Appendix A.6 of the revised manuscript.
Q3: Can you quantify benign-content removal and its impact on task completion, and explain cases where utility under attack exceeds benign utility?
We additionally evaluate benign utility on -bench (Yao et al., 2024; Barres et al., 2025), an agent benchmark involving tool interactions, using two victim models: GPT-6-Luna and GPT-4.1-mini. We evaluate 25 tasks each in the Airline and Retail domains, adopting a criterion, where a task is considered successful only if all three independent trials succeed. As shown in Table 3, SpanGuard achieves comparable task success rates to no defense across both victim models, with only a modest utility reduction on GPT-4.1-mini. Interestingly, SpanGuard achieves higher success rates than no defense with GPT-6-Luna. We attribute this improvement to variations in the victim model's responses rather than gains from the defense itself.
Table 3. Benign task success rates on -bench with two victim models.
| Victim Model | Defense | Airline | Retail | Pooled |
|---|---|---|---|---|
| GPT-6-Luna | No defense | 41.3% | 73.3% | 57.3% |
| SpanGuard | 45.3% | 80.0% | 62.7% | |
| GPT-4.1-mini | No defense | 51.1% | 80.0% | 65.6% |
| SpanGuard | 46.7% | 75.6% | 61.1% |
We further analyzed the 167,356 content blocks processed during the benign utility evaluation with GPT-6-Luna. SpanGuard removed only 17 blocks (0.010%), none of which changed the corresponding task outcomes. We identify two typical sources of false removals: (1) instructions unrelated to the user's task, which the judge considers unauthorized and whose removal generally does not affect task completion; and (2) instructions from external sources that the user has implicitly authorized (e.g., asking the agent to follow instructions in an email), where the judge may fail to recognize this delegation. The latter reflects a trade-off between utility and security, whose appropriate balance depends on the application scenario.
Regarding why utility under attack can exceed benign utility, SpanGuard is designed to remove the core unauthorized instructions rather than necessarily eliminate every part of an injected payload. The remaining content may contain prompt-engineering elements that reinforce the agent's instruction-following behavior. Once the core malicious objective is removed, these elements can sometimes help the agent complete the original task. We believe this phenomenon also exposes a limitation in the default agent configuration of AgentDojo: its system prompts may not sufficiently reinforce instruction-following behavior, allowing external content to inadvertently improve task compliance.
Yao, S., Shinn, N., Razavi, P., & Narasimhan, K. (2024). $\tau $-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. arXiv preprint arXiv:2406.12045.
Barres, V., Dong, H., Ray, S., Si, X., & Narasimhan, K. (2025). -Bench: Evaluating Conversational Agents in a Dual-Control Environment. arXiv preprint arXiv:2506.07982.
We sincerely thank the reviewer for the thoughtful feedback and constructive suggestions. We appreciate the recognition of SpanGuard's decoupled design and security benefits. The comments have helped us further examine the localization mechanism, adaptive robustness, benign utility, and computational efficiency. We address the concerns point by point below.
To evaluate the effectiveness of our localization strategy, we compare whole-output authorization with four segmentation alternatives, keeping the authorization judge and filtering procedure unchanged.
Table 1. Comparison of different segmentation strategies.
Whole-output authorization achieves 0% ASR, demonstrating that our small judge can effectively identify unauthorized instructions when localization is simplified to a binary classification of whether the entire output contains an injection. However, removing the entire output also discards benign content, resulting in only 19.59% UA and preventing the agent from completing its original task.
Our segmentation strategy addresses this limitation by separating injected instructions from surrounding benign content while preserving the integrity of the instructions for authorization. As shown in Table 1, it substantially improves UA to 69.07% while maintaining a low ASR of 2.06%. In contrast, sentence-level, fixed-size, and random segmentation fail to achieve a comparable security–utility balance. These results demonstrate that effective localization enables the judge to make reliable block-level decisions while avoiding unnecessary removal of benign content, thereby helping the agent recover its ability to complete the user's task.
Furthermore, our semantic segmentation requires only 36.8 judgments per task, substantially fewer than the alternative fine-grained strategies (57.8–114.4), further reducing authorization overhead.