Prompt injection success depends on the channel it uses
Reviewing TRACER: Trace-Regularized Training Against Indirect Prompt Injection · Kshitij Mishra, Salem Lahlou, Nils Lukas

Researchers show that the same indirect prompt injection succeeds far more often when it arrives as retrieved content than as a chat message. Their channel-aware training sharply cuts attack success on small models, but it has only been tested against templated attacks, and the clearest lesson is to test every channel an agent reads.
Take one malicious instruction and do not change a word of it. Send it to a model as a follow-up chat message, and it works 18% of the time. Put the same text inside what looks like a retrieved document, and it works 53% of the time. The payload is identical. Only the envelope changed.
That result interests me more than the defence the researchers built on top of it. Indirect prompt injection is the attack where instructions arrive through content the model was asked to read, not obey. Think of a search result, a tool response or a message from another agent. The researchers show that a model's resistance depends heavily on which channel the text arrives through. Retrieved context seems to carry more authority than conversation, so the model defers to it.
For an attacker this is cheap leverage. You do not need a better payload. You need control over where it appears, and you rewrap it as a document, a tool output or an agent message until one lands. A defence trained against injection in one wrapper may never have seen the others.
The fix the researchers propose, called TRACER, randomises the channel during training. Each episode has three turns. The model first solves a clean task and writes out its reasoning. Then the same attack arrives through a randomly chosen wrapper, and the model answers again. When the injected evidence is bogus, it is rewarded for keeping the right answer and staying close to the reasoning it already committed to. It is still meant to accept genuine corrections, and in mixed tests it largely does.
The results are good. On a small 3B model doing school maths problems, attacks framed as retrieved content fell from roughly two thirds succeeding to about one in sixteen. Clean accuracy stayed mostly intact. The telling detail is that coverage was uneven. Training only on the retrieved-document framing gave the deepest defence there but transferred poorly. Training on tool outputs gave something flatter and broader, and training on both did best on average. The channel lesson applies to the defence as much as the attack.
Now the sceptical reading. The attacks are templates, chosen to isolate the framing effect, and the researchers say plainly this is not robustness against an optimising or adaptive attacker. Nobody tried to beat the defence knowing it was there. Maths also has a checkable answer, and the reward is anchored to it. Most agent tasks have no such ground truth, so I am not sure how well that anchor carries over. The researchers position it as a training-time layer alongside runtime controls, which is the right framing.
What I take from it is narrower and more useful than the defence. If you test injection resistance, test every channel your agent actually reads. The wrapper is part of the payload.
Further analysis
Problem
The paper studies indirect prompt injection: malicious instructions embedded in untrusted external content (retrieved documents, tool outputs, or messages from other agents) that can override an LLM’s intended behaviour. It shows that a model’s defence is channel-conditioned: the same adversarial payload can have very different success depending solely on how it is presented. This matters because modern LLM deployments routinely ingest external text from multiple channels, and prior defences are typically trained and evaluated within a single presentation wrapper.
Approach
The authors introduce TRACER (Trace-Regularized Adversarial Channel Exposure with Reward-shaping), a deployment-matched adversarial training framework that treats the presentation channel as a sampled training variable. Each training episode is a three-turn game: the model first solves the clean task and produces a reasoning trace, the same adversarial payload is then rendered through a sampled channel, and the model produces a post-attack trace and answer. TRACER combines a composite, answer-anchored, evidence-gated reward that balances post-attack correctness, process quality, anchor retention, corrigibility, and length control, with ATRC, a trace regulariser that aligns post-attack responses to committed spans from the clean trace when the injected evidence is invalid. Optimisation uses GRPO-style reward optimisation with ATRC regularisation. Experiments use GSM8K on Qwen2.5-3B-Instruct (4-bit QLoRA) and include 3B and a 7B scaling study; evaluation wrappers include follow-up, RAG, tool-output and agent-message framings.
Key Findings
- Framing gap: holding payloads fixed, the same attack’s conditional attack success rate (ASR) rises from 18% as a conversational follow-up to 53% when rendered as retrieved context, demonstrating an authority or framing gradient across wrappers.
- TRACER effectiveness: on GSM8K with Qwen2.5-3B-Instruct, TRACER reduces RAG-framed ASR from 65.5% (base) to 6.1% while preserving clean accuracy around 78–82%.
- Component ablation: answer-only channel exposure yields 21.3% RAG ASR, adding the composite reward reduces ASR to 13.8%, and ATRC further reduces it to 6.1%.
- Cross-framing trade-off: single-wrapper (RAG) training gives the deepest native defence but transfers unevenly; tool-output training produces a flatter, broader defence. Joint RAG+tool training gives the best 3B average ASR (13.9%).
- Scaling and early stopping: a 7B model shows milder framing gaps and achieves a 9.4% average ASR across framings after a single epoch of RAG training; many gains appear early in training.
- Robustness vs utility: mixed-evidence tests preserve high clean/evidence accuracy (about 81–83%) while reducing contamination-induced flip rates from ~46–58% to ~14–18%.
Limitations
The experiments use template-based attacks to isolate the framing effect; they do not claim robustness to arbitrary optimisation-based or multi-turn adaptive adversaries. TRACER training is demonstrated mainly on Qwen2.5 at 3B and 7B; broader architectures, tasks and fully adaptive white-box attacks remain future work. TRACER is a training-time defence and is intended to be combined with runtime safeguards.
Implications
Offensively, an adversary can increase success simply by changing the presentation channel of malicious payloads (for example rewrapping a prompt as a retrieved document, tool response or agent message), exploiting the framing gap to bypass defences trained in a different wrapper. The results imply that attackers who can control the source or wrapper of untrusted content gain a powerful lever to flip otherwise secure systems. The paper also notes dual-use risk: the attack templates used for evaluation could be adapted to probe deployed systems, underscoring the need to pair channel-aware training with runtime protections.
The paper title, authors and abstract
TRACER: Trace-Regularized Training Against Indirect Prompt Injection
Indirect prompt injection uses untrusted retrieved content, tool outputs, or agent messages to override an LLM's intended behavior. We show that defense robustness is channel-conditioned: the same attack succeeds 18% of the time as a follow-up message but 53% when placed in retrieved context. We propose TRACER (Trace-Regularized Adversarial Channel Exposure with Reward-shaping), a channel-aware adversarial training method that samples presentation wrappers and combines an answer-anchored, evidence-gated reward with ATRC, which aligns attacked reasoning with clean evidence when an injection is invalid. On GSM8K with Qwen2.5-3B-Instruct, TRACER reduces RAG-framed ASR from 65.5% to 6.1% while preserving 78-82% clean accuracy. Joint RAG+tool training achieves 13.9% average ASR across framings at 3B scale, while a single epoch at 7B reaches 9.4%. These results demonstrate that robust defenses must explicitly train and evaluate across deployment channels.


