TL;DR
When an LLM agent reads untrusted emails or web pages, hidden instructions can hijack its actions. Adding a separate "supervisor" LLM to check those actions stops most attacks, but introduces a surprising catch: reading the untrusted data contaminates the supervisor too, causing it to block legitimate, task-completing actions. Requiring the supervisor to quote the offending text directly from the proposed action—and cancelling any block in code when that quote is missing—restores safe task completion from 8% to nearly 80%.
What Problem Does This Paper Address?
Tool-using LLM agents (think office assistants that read documents, check web pages, and send emails) face indirect prompt injection: malicious instructions planted in external data that trick the agent into leaking credentials, adding an attacker's bank details, or altering facts.
A popular fix is adding a runtime guardrail or supervisor. However, two practical questions are rarely measured together on the same tasks and random seeds:
- Where should the supervisor sit? (At the input, around tool calls, inside the agent's own conversation, in an independent context, in a separate OS process, or under a separate OS user?)
- What do its blocks cost? Stopping an attack is great, but if the guard also halts the user's legitimate task—or traps the agent in expensive retry loops—the system becomes unusable.
Methods
The authors built a controlled test harness to compare four guard placements and their combinations:
- Deterministic rules & classifiers: Permission rules (blocking out-of-grant email recipients and credential reads), a 30-character verbatim-copy taint check, and an input injection classifier (ProtectAI DeBERTa-v3).
- Self-review: Asking the agent's own model, in the same conversation, if its proposed action is safe.
- Independent & Hybrid supervisors: A separate model instance with a clean context that inspects the task, granted recipients, read data (first 600 characters per source), and proposed action. The hybrid version runs deterministic permission and taint rules first, only asking the LLM supervisor if those pass.
To fix over-blocking, they introduce evidence-checked blocks: to block an action, the supervisor must copy the offending text from the action itself into an evidence field. Deterministic code checks whether that quote actually appears in the tool name or arguments; if not, the block is cancelled and the action runs.
They also test cross-session memory poisoning (using a write gate and HMAC-signed instruction files), adaptive attackers (rewriting injections up to five times), process/OS-user isolation (with single-use HMAC-SHA256 approvals), and a post-hoc log reviewer.
Datasets
- Single-session office harness: 222 cases per configuration (180 attacked cases spanning 5 goals $\times$ 6 wordings $\times$ 6 tasks, plus 18 benign and 24 "hard-benign" cases containing legitimate attack-like text such as real IBANs or deadline changes).
- Cross-session memory harness: A 40-note vault with 180 attacked cases (split between agent-clipped web pages and out-of-band synced notes), 10 benign, and 15 hard-benign cases.
- AgentDojo: A public benchmark (v1.2.2) used as an external check, with 144 attacked and 48 benign runs across four suites.
Key Insights and Ideas
- Self-review is not a security boundary: For small models (Qwen3-1.7B and 4B), a reviewer in the same conversation reads the injected text as an instruction too and simply approves the attack.
- Context isolation $\neq$ data isolation: An independent supervisor has a clean prompt, but it still has to read the untrusted data to judge an action. That data contaminates its judgement, causing it to repeatedly block clean retries—even when the agent is given feedback and recovers.
- Evidence-checked blocks act as a contamination filter: By forcing the supervisor to ground its block in the proposed action's actual text, code can automatically discard hallucinated or contaminated blocks.
- Deterministic rules must sit upstream: Because quote-cancellation fails open on purpose-based reads (like reading a credential) or paraphrases, an evidence-checked supervisor needs deterministic permission rules in front of it (hybrid + evidence).
- In-grant content sabotage is the main residual risk: Changing a deadline in an email to an allowed recipient still succeeds 58–78% of the time, because the action looks plausible without ground-truth fact-checking.
- OS isolation only matters when the agent is compromised: Moving the supervisor to its own process doesn't change honest-agent verdicts, but against a compromised agent, only a separate OS user blocks all scripted subversion attempts.
Key Results
- Main single-session study (Qwen3-4B agent): An independent Qwen3-4B supervisor cuts attack success from 86% to 22%, but safe completion (task done + attack failed) drops to 8%. Adding evidence-checked blocks raises safe completion to 77% (independent) and 79% (hybrid), and to 84% with a Phi-4-mini (3.8B) supervisor.
- Scaling supervisors: A 4-bit Qwen3-8B supervisor with the evidence rule allows only 1–2 of 180 attacks while still cancelling 166–168 clean-action blocks. Granite-3.3-2B remains weak (39–52 attacks won).
- Memory poisoning: Evidence-checked write gates restore safe completion from 57 to 134/180 (and 161/180 when paired with signed instructions), though out-of-band synced notes bypass write gates entirely.
- Compromised agent: Against 60 scripted attacks (+ 5 controls), an in-process supervisor fell in 25 trials, a same-user separate process in 15, and a separate OS user in 0.
- AgentDojo: The evidence-checked supervisor lowers attacks won (42 to 32 of 144) but does not raise safe completion (30 vs. 27), largely due to 22 list-valued JSON parse errors causing fail-closed blocks.
Limitations and Future Work
The main harness uses small models (1.7B–4B agents, 2B–8B supervisors), short synthetic tasks, and a 600-character source prefix limit. The adaptive attacker was also a small model limited to five rewrites; a stronger attacker that splits or re-encodes harmful values inside the user's grant could evade exact quote matching. Finally, the authors did not run head-to-head comparisons against MELON or Task Shield on their harness. Future work includes testing evidence-checked supervision with larger agents on public benchmarks like AgentDojo, unquantised stronger supervisors, and attackers larger than the agent itself.
Summary updated