Skip to content

CoER: Defending against adaptive indirect prompt injection with adversarial co-evolution and refinementCoER: Defending against Adaptive Indirect Prompt Injection via Adversarial Co-Evolution and Refinement

arXiv: Agent & MCP Security· arXiv:2609.07529· Boyang Zhang, Qingxin Xiao, Lingwei Dang, Qingyao Wu·Indexed by this site · 2026-10-01· Originally publishedSelected DefensesSelectedAttention38

Quick read

Defenses

Based on the paper PDF (generated by Gemini); refer to the original

CoER reduces Qwen3.5-9B's adaptive ASR to 0.22% across seven domains through bilateral adversarial co-evolution and refined defense adaptation to IPI.

Threat modelThe defender executes user tasks and controls tool calls; the attacker only controls the tool return text at configured points Z. The attacker observes the target/contract, public execution trajectories, surrounding text, and historical attempts (without access to private instructions and reasoning), can inject multiple times within a single task, and adapts subsequent attacks based on the defender's visible responses and execution traces. Attack success and task completion are determined by independent verifiers.

Questions
Tool-calling agents are vulnerable to indirect prompt injection (IPI) attacks. Existing defenses mostly target fixed attack patterns, but in multi-turn tasks, attackers can adjust subsequent injections based on execution feedback, causing fixed defenses to risk failure under adaptive attacks.
Methods
Models multi-turn interactions within a task as general-sum and Markov games, and proposes the CoER framework: first cold-starting the attacker via SFT, then using bilateral adversarial reinforcement learning to have both attacker and defender play against current and historical opponents, and finally using retained attackers to guide a strong teacher in generating trajectories to fine-tune the defender.
Experiments and results
In seven-domain evaluation, CoER reduces Qwen3.5-9B's adaptive ASR from 41.31% (Base) to 0.22%, and increases Safe-U from 39.60% to 76.24%; it also shows lower ASR on AgentLAB and InjecAgent.
Limitations and future work
The authors note that the method relies on strong teachers and a sequential three-phase process; sensitivity to population management hyperparameters is not fully characterized; experiments cover seven AgentDyn domains and the Qwen3.5-9B backbone, without testing other agent frameworks, non-text modalities, or larger models.
Experimental setupQwen3.5-9B · AgentDyn、AgentDojo et al. · U、ASR et al.
Evaluated models
Qwen3.5-9B
Benchmarks
AgentDynAgentDojoAgentLABInjecAgent
Metrics
UASRSafe-UEffective ASR
AI summaryand selection rationaleThe researchers propose CoER, which models tasks with multi-turn tool calls and multiple injections as general-sum and Markov games, thereby training defenses that can adapt to evolving attackers. The method first initializes attackers with successful trajectories, then uses bilateral adversarial reinforcement learning (BA-RL) to retain both sides' historical policies as opponent populations and mix old and new opponents, then reuses these attackers to challenge the teacher agent, fine-tuning the co-evolved defender using only demonstrations that pass safety verification and complete the task. Across seven domains and three random seeds, CoER reduces the adaptive attack success rate from 41.3% to 0.2% and increases the safe completion rate from 39.6% to 76.2%. It also shows stronger resistance to attacks on external benchmarks, and ablation experiments further validate the effectiveness of historical opponent mixing and population-based refinement.

The researchers propose CoER, which models tasks with multi-turn tool calls and multiple injections as general-sum and Markov games, thereby training defenses that can adapt to evolving attackers. The method first initializes attackers with successful trajectories, then uses bilateral adversarial reinforcement learning (BA-RL) to retain both sides' historical policies as opponent populations and mix old and new opponents, then reuses these attackers to challenge the teacher agent, fine-tuning the co-evolved defender using only demonstrations that pass safety verification and complete the task. Across seven domains and three random seeds, CoER reduces the adaptive attack success rate from 41.3% to 0.2% and increases the safe completion rate from 39.6% to 76.2%. It also shows stronger resistance to attacks on external benchmarks, and ablation experiments further validate the effectiveness of historical opponent mixing and population-based refinement.

Why it was selectedThe paper models adaptive indirect prompt injection against tool agents as a multi-turn game, uses adversarial co-evolution plus teacher demonstration fine-tuning, and provides comparisons of attack success rates and safe task completion rates across seven domains.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The paper attempts to address the problem of tool-calling agents defending against adaptive indirect prompt injection in multi-turn tasks, where the attacker continuously adjusts its strategy based on execution feedback.

    The paper attempts to solve the defense problem of tool-calling agents against adaptive indirect prompt injection (IPI) during task execution.

    • Application scenario and importance: When tool-augmented language agents alternate between reasoning and tool calls, untrusted tool-returned results may contain malicious instructions, inducing data leakage, tool abuse, or unauthorized operations (Section 1).
    • Shortcomings of existing defenses: The authors state that most existing defenses are trained and evaluated against fixed, non-adaptive attack patterns, and are difficult to succeed against adaptive attacks that can adjust subsequent injections based on execution trajectories (Section 1).
    • Core observation and hypothesis: Within the same task execution cycle, the attacker adjusts subsequent injections based on the defender's visible responses, and the defender's actions in turn change the tool state and subsequent injection opportunities; the authors believe that effective defense must face a continuously evolving attacker during training and achieve adaptivity (Sections 1, 2).
    • Proposed approach: The paper proposes the CoER framework combining multi-turn adversarial co-evolution with verifier-guided refinement (Sections 1, 4).
    • Threat model:
      • Goals: The attacker pursues a malicious goal g (e.g., data exfiltration), while the defender aims to safely complete the user task x (Section 3).
      • Knowledge: The attacker cannot access the defender's private system prompt, parameters, global state, or internal reasoning thoughts (Appendix A).
      • Capabilities: The defender controls tool calls; the attacker only controls the tool-returned text at configured points Z, can inject multiple times within a single task, and can adaptively generate payloads using up to 6,000 characters of public execution trajectory and historical attempts (Section 3, Appendix A).
      • Victim system: Tool-calling language model agents (Section 3).
  2. What related research exists?

    The paper reviews three research lines—IPI evaluation and defense, adaptive attack discovery and refinement, and attack-defense co-evolution—and emphasizes its own positioning as a closed-loop game within task execution.

    IPI Benchmarks and Defenses

    • InjecAgent (Zhan et al., 2024), AgentDojo (Debenedetti et al., 2024), Agent Security Bench (Zhang et al., 2025), AgentDyn (Li et al., 2026), and AgentLAB (Jiang et al., 2026) construct IPI evaluation benchmarks in tool-use environments; Zhan et al. (2025) probe weaknesses beyond fixed attack distributions through adaptive evaluation.
    • Existing defenses employ provenance marking (Hines et al., 2024), structured inputs and preference alignment (Chen et al., 2025a,b,c; Wallace et al., 2024), instruction priority embedding (Wu et al., 2025), prompt guards (Li et al., 2025b), and control-flow constraints (Debenedetti et al., 2025; Shi et al., 2025; Li et al., 2025a).

    Adaptive Attack Discovery and Refinement

    • Perez et al. (2022), Hong et al. (2024), and Liu et al. (2025) use red-teaming prompts and curiosity-driven rewards to broaden attack discovery; Lee et al. (2025) and Dabas et al. (2026) use GFlowNet and jailbreak dictionaries to support safety fine-tuning; DialTree (Guo et al., 2026) learns multi-turn jailbreak strategies via dialogue tree RL.
    • In the IPI domain, AutoInject (Chen et al., 2026) and PISmith (Yin et al., 2026) learn transferable injections; RETA (He et al., 2026) generates attacks against a frozen baseline before defender reinforcement learning.

    Attack-Defense Co-Evolution

    • Lifelong safety alignment (Wang et al., 2025a) studies attack-defense iteration on single-turn jailbreaks; MAGIC (Wen et al., 2026) establishes an adaptive dialogue safety game; GPT-Red (Wallace et al., 2026) performs large-scale red-teaming via self-play; ARLAS (Wang et al., 2025b) alternates injections and network agent actions, jointly training attack and defense while exposing the defender to historical attackers. The authors note that co-training may leave residual vulnerabilities.

    Baseline Methods and Evaluation Benchmarks

    • Baselines compared in experiments include untrained Base (Qwen3.5-9B), PPO and GRPO trained on fixed templates, co-training baseline without historical opponent pool NoPop, and locally reproduced MAGIC, Lifelong Defender i2 LAT/RR, and Meta-SecAlign-8B; evaluation benchmarks are AgentDyn, AgentDojo, AgentLAB, and InjecAgent.

    Positioning of This Paper

    • The authors state that CoER places adaptive attack discovery and defense learning inside feedback-dependent tool execution, exposing both attacker and defender to historical opponents, and reuses the learned attacker population to collect verified strong-teacher demonstrations for refinement.
  3. How does the paper address this problem?

    CoER models attack and defense as general-sum and Markov games, cold-starts the attacker via SFT, co-evolves both sides through bilateral historical adversarial RL, and then refines with teacher data guided by retained attackers.

    The paper proposes the CoER (Co-Evolution and Refinement) framework, combining multi-round adversarial co-evolution with verifier-guided refinement.

    Problem Setting and Game Modeling

    The paper models alternating tool calls and injections within a single task as a finite-horizon, turn-based, partially observable general and Markov game G_c (Section 3). Each trajectory is judged by an independent verifier for whether the attack succeeded I_atk and whether the task was completed I_task. The terminal payoffs are set as:

    • Attacker payoff: R_A = I_atk + 0.05(1 - I_atk)I_fmt, a one-time format reward of 0.05 when the format is valid and non-empty.
    • Defender payoff: RD = 1.0 · 𝕀(Iatk=0 ∧ Itask=1) − 0.2 · 𝕀(Iatk=0 ∧ Itask=0) − 1.0 · 𝕀(Iatk=1), the defender receives positive payoff only when not compromised and the task is completed; being compromised is directly judged -1.0 and cannot be offset by completing the task (Section 4.2).

    Stage One: Attacker Supervised Initialization (Attacker SFT)

    To alleviate cold-start exploration difficulty under sparse terminal rewards, the paper uses strong models to generate diverse attack demonstrations (Section 4.1):

    • Demonstration generation and filtering: DeepSeek V4 Pro and Seed2.0 are used to attack the base defender over multiple rounds on the training configurations, and the safety verifier filters out 3,995 successful dialogues (containing 11,655 attack turns).
    • All-turn supervised fine-tuning: Cross-entropy loss is computed over all generated turns of the attacker for fine-tuning, preserving early attempts and subsequent adjustment behavior, yielding the initial attack policy πA0; the defender remains at the initial base πD0 (Section 4.1, Appendix B.1).

    Stage Two: Bilateral Adversarial Reinforcement Learning (BA-RL)

    Both sides conduct online adversarial training on 12,705 training configurations (Section 4.2):

    • Bilateral historical opponent pool mechanism: To prevent overfitting to the latest adversarial pairing, both attacker and defender each maintain an opponent pool containing 4 historical slots and 1 examination slot. Injected samples are mixed-sampled at 0.40 (current vs. current cc), 0.25 (historical attacker vs. current defender hc), 0.25 (current attacker vs. historical defender ch), 0.10 (fixed template vs. current defender tc) (Table 3).
    • Role-masked PPO optimization: Each has an independent Critic, and loss and GAE advantage are computed only on tokens generated by itself (γ=1.0, λ=0.95); tool outputs and opponent actions are masked as visible context. An asymmetric clipping term is used: ℓjr,clip = min(ρjr Âjr, clip(ρjr, 1 − ϵ−r, 1 + ϵ+r) Âjr), with Actor learning rate 5e-7 and Critic learning rate 1e-5 (Section 4.2, Table 3).
    • Checkpoint selection: BA-RL selects the defense policy πDsel at step 430 by the defender's highest training reward, while retaining the final attacker population P_A^ret (Section 5.1).

    Stage Three: Population-Guided Policy Refinement (Defender SFT)

    To repair weaknesses left after co-evolution and maintain task utility, the retained attacker population is used to generate high-quality defense trajectories (Section 4.3):

    • Adaptive teacher demonstration collection: The retained attackers are used to apply adaptive attacks to GLM-5.2 and DeepSeek V4 Pro, filtering out trajectories where the attack failed, the task succeeded, there were no tool anomalies, and at most 2 repeated calls were included; after deduplication, 4,907 attacked demonstrations and 853 untriggered replay demonstrations are obtained (5,760 total, replay share 14.81%) (Section 4.3, Appendix B.4).
    • Supervised fine-tuning and freezing: With πDsel as initial weights, full-parameter causal LM cross-entropy fine-tuning is performed on the assistant turns of the teacher trajectories, with learning rate 5e-6, trained for 1 epoch (360 steps) and then frozen as the final defense model πDfinal (Table 4).
  4. What experiments did the paper conduct?

    CoER reduces adaptive ASR to 0.22% and raises Safe-U to 76.24% across seven domains, while maintaining strong defense on external benchmarks and under cumulative attacks.

    Experimental Setup

    • Models under test: Same-backbone baselines include Base (Qwen3.5-9B), PPO, GRPO, NoPop, BA-RL, and CoER; cross-model references include MAGIC (Qwen2.5-7B), Lifelong Defender i2 LAT/RR, Meta-SecAlign-8B, Qwen3.6-27B, GPT-5.4, DeepSeek V4 Pro, and GLM-5.2-Thinking (Section 5.1, Table 1).
    • Evaluation datasets and scale: The main workload covers 7 suites (AgentDyn 3: DailyLife, GitHub, Shopping; AgentDojo 4: Banking, Slack, Travel, Workspace). Each evaluation seed contains 1,512 cases (157 clean cases, 168 fixed-template cases, 1,187 adaptive cases, excluding 2 pre-declared conflicting cases) (Section 5.1, Table 5).
    • Baseline methods: Untrained Base, PPO and GRPO trained on fixed templates, adversarial training without historical opponent pool NoPop, and unrefined online defender BA-RL (Section 5.1).
    • Metric definitions: U is task completion rate; ASR is attack success rate; Safe-U is the proportion of safe and completed tasks (Itask(1 - Iatk)); U - Safe-U measures the proportion of compromised but completed tasks (Section 5.1).
    • Evaluation method: Deterministic predicates based on function trajectories or final states independently judge attack and task outcomes; no LLM judge scoring is used in evaluation (Section 4.2, Appendix A).
    • Sample size and repetitions: Fixed checkpoints are independently evaluated 3 times on evaluation seeds 0, 1, 2 (4,536 executions per model), reporting mean and sample standard deviation (Section 5.1).

    Main Results

    The table below shows the evaluation performance of same-backbone baselines on the main workload (from Table 1a):

    Swipe horizontally to read the table

    DefenderClean U (%) ↑Fixed ASR (%) ↓Adaptive U (%) ↑Adaptive ASR (%) ↓Adaptive Safe-U (%) ↑
    Base77.92 ± 1.6013.10 ± 0.6061.08 ± 0.7341.31 ± 0.8939.60 ± 1.11
    PPO75.58 ± 1.334.96 ± 1.2463.21 ± 2.3131.03 ± 0.4246.70 ± 0.63
    GRPO78.77 ± 1.336.15 ± 0.3456.25 ± 0.0539.82 ± 0.2736.90 ± 0.53
    NoPop80.04 ± 3.514.56 ± 0.3468.49 ± 1.1928.14 ± 0.3052.93 ± 1.05
    BA-RL79.19 ± 0.744.37 ± 1.2469.08 ± 0.5925.78 ± 1.0254.84 ± 0.80
    CoER80.47 ± 1.470.40 ± 0.6976.47 ± 1.140.22 ± 0.1376.24 ± 1.08
    • Reducing adaptive attack success rate and improving safe utility: The authors state that CoER achieves the highest adaptive Safe-U (76.24%) and lowest adaptive ASR (0.22%) among same-backbone baselines, while Clean U reaches 80.47% under no-attack conditions (Section 5.2).
    • Bilateral historical opponent pool outperforms unilateral and no-population mechanisms: In a single-run ablation before Defender SFT, bilateral history achieves adaptive Safe-U of 54.09%, higher than no-population NoPop (51.73%), pure defender-side history (52.15%), and pure attacker-side history (52.65%) (Section 5.2, Table 10).
    • Refinement phase brings significant safety improvement: Across 3 evaluation seeds, Defender SFT reduces average adaptive ASR from 25.78% (BA-RL) to 0.22%, and increases adaptive Safe-U from 54.84% to 76.24% (Section 5.2).

    External Benchmark Generalization Evaluation

    • What was tested: Generalization defense capability tested on external benchmarks AgentLAB (long-horizon adaptive attacks by GPT-5.4) and InjecAgent (Base and Enhanced payloads), as well as official AgentDyn / AgentDojo protocols (Section 5.3, Table 2).
    • Results: Under AgentLAB task injection, CoER's ASR is 14.12% and Safe-U is 77.13% (Base: 37.41% and 37.83%, respectively) (Table 2, Table 13); on InjecAgent, CoER's ASR is 0.00% (0/1043) under Base payloads and 1.97% (20/1016) under Enhanced payloads (Table 14).
    • Authors' interpretation: The authors state that CoER demonstrates generalized defense capability on external payloads not seen in training and with independent attacker settings, but the 14.12% ASR on AgentLAB indicates residual vulnerabilities remain (Section 5.3, Appendix D).

    Refinement Attribution and Continued Adversarial Robustness

    • What was tested: In a 2×2 ablation, cross-initialization sources (Base and BA-RL) and refinement data sources (fixed attacks and population-derived) are varied, and continued adversarial robustness is tested under alternating attacks from multiple attackers (cumulative budget from 1 to 8) and continued training of attackers after freezing the defender (a200 continued to a270) (Section 5.4).
    • Results: The 2×2 attribution shows that BA-RL initialization adds 8.42 percentage points to adaptive Safe-U, and population data adds 10.36 percentage points (Table 1c); under cumulative 8 attacks, CoER's joint ASR is 4.97% (Table 8); in post-hoc attacker reinforcement learning, the attacker reaches a peak Effective ASR of 0.59% at a230 (Figure 5).
    • Authors' interpretation: The authors state that co-evolution provides both stronger defense initial weights and an attacker population that induces effective refinement demonstrations, with the combination working best (Section 5.4).

    Attacker Evolution and Execution Feedback Ablation

    • What was tested: Attacker capability improvement is evaluated through frozen cross-games, and the effect of attackers using execution feedback is tested (Section 5.5, Table 17, Figure 4a).
    • Results: Against Base, the attacker's Effective ASR rises from an initial 38.80% to 49.55% after SFT, and to 65.65% after BA-RL (Figure 4a); feedback ablation shows that full feedback yields ASR of 38.75%, removing all feedback reduces ASR to 29.57%, and removing previous attempts reduces ASR to 35.80% (Table 17).
    • Authors' interpretation: The authors state that co-evolution enhances attack capability, and the trained attackers indeed exploit execution consequences and task-aligned historical information for adaptive adjustment (Section 5.5).

    Other Ablations and Analyses

    • Injection budget sensitivity within a single task: When the injection cap increases from 1 to all, CoER's ASR remains at 0.00%–0.17%, and Safe-U ranges from 70.94%–72.28% (Table 9).
    • Tool call length stratification: Based on the number of tool calls in clean executions, divided into short (≤3), medium (4–7), and long (≥8), CoER achieves Safe-U of 54.29% and ASR of 0.52% in long tasks (Table 11b).
    • Single-domain performance under the official AgentDyn protocol: In the Travel suite, CoER's Safe-U decreases by 15.00 percentage points compared to BA-RL (from 82.14% to 67.14%), while ASR remains unchanged at 2.86%, reflecting a decline in task completion rate (Section 5.3, Table 12).
    • Failure case mechanism analysis: In code repository operation case R4, CoER successfully avoids malicious operations but outputs a truncated tool call causing the legitimate task to fail (Appendix G).
  5. What are some points that can be further explored?

    The authors note that the method relies on strong teachers and a sequential process, is sensitive to hyperparameters, and the evaluation scope does not cover multimodal inputs, other agent frameworks, or larger model backbones.

    Limitations and future directions noted by the authors

    • Strong teacher dependence and data generation cost: The method combines bilateral reinforcement learning with verified demonstrations from a strong teacher model; the refinement step increases data generation cost and introduces dependence on the teacher model (Section 6).
    • Sequential three-stage pipeline: SFT initialization, BA-RL, and Defender SFT must be executed in order, increasing the complexity of the training pipeline (Section 6).
    • Population management hyperparameter sensitivity not fully characterized: Population management introduces several hyperparameters whose sensitivity has not been fully characterized (Section 6).
    • Generalization scope not validated on other frameworks and modalities: Experimental evaluation only covers the AgentDyn-related environment suite; generalization to other agent frameworks, non-text modalities, or larger model backbones remains untested (Section 6).
    • Limitation of same-family attacker and defender models: The attacker and defender share the same base model family (Qwen3.5); heterogeneous attackers may expose security weaknesses that same-family co-evolution fails to discover (Section 6).
    • Future improvement directions: The authors note that improving reward design may reduce dependence on the teacher, and introducing a diverse attacker population may broaden vulnerability coverage (Section 6).

    Experimental coverage

    • Model scope tested: Experiments mainly conduct full co-evolution and refinement on Qwen3.5-9B; cross-model comparisons only locally reproduce MAGIC (Qwen2.5-7B), the Lifelong Defender i2 series, Meta-SecAlign-8B, and inference comparisons of commercial closed-source models, without testing co-evolution training at larger parameter scales (Section 5.1, Table 1b).
    • Environment and domain scope: The main evaluation covers 7 domains in AgentDyn and AgentDojo (DailyLife, GitHub, Shopping, Banking, Slack, Travel, Workspace), as well as external benchmarks AgentLAB and InjecAgent, all text-based interaction environments (Table 2, Table 5).
    • Attacker interface and interaction information: The adaptive attacker receives normalized target contracts, public execution trajectories, and feedback from historical attempts at injection points; the paper does not expose the defender's private instructions, system prompts, or internal reasoning content to the attacker (Appendix A).
    • Teacher model selection: The demonstration refinement stage only uses GLM-5.2 and DeepSeek V4 Pro as teachers; the paper does not report results with other teacher models or self-refinement without a teacher (Section 4.3, Appendix B.4).
    • Unreported information: The paper does not report cumulative compute time or token costs for end-to-end online training and teacher data generation (Appendix B).
  6. Summarize the main content of the paper

    CoER targets adaptive IPI by combining bilateral adversarial co-evolution with strong teacher refinement, reducing Qwen3.5-9B's adaptive ASR to 0.22% across seven domains.
    • Research positioning: Addressing the issue that language model agents are vulnerable to adaptive indirect prompt injection (IPI) threats in tool invocation, and existing defenses are mostly limited to fixed attack patterns, this paper proposes the CoER framework that integrates bilateral adversarial co-evolution of attack and defense with validator-guided refinement.
    • Core method: Multi-turn task interaction is modeled as a general and Markov game. First, successful attack trajectories are used for SFT cold-start of the attacker. Then, adversarial PPO reinforcement learning with a bilateral historical opponent pool jointly advances the capabilities of both attack and defense. Finally, a reserved attacker population is used to challenge a strong teacher model, collecting trajectories that pass dual validation of safety and task completion to fine-tune the defender.
    • Core experimental results:
      1. In evaluations on 1,187 adaptive cases across seven domains, CoER reduces adaptive ASR to 0.22±0.13% on the Qwen3.5-9B backbone, achieves Safe-U of 76.24±1.08%, and maintains Clean U (success rate on non-attack tasks) at 80.47±1.47% (Table 1a).
      2. Attribution experiments show that compared to Base initialization and fixed attack data, BA-RL initialization brings an 8.42 percentage point improvement in Safe-U, population-derived data brings a 10.36 percentage point improvement, and the combination achieves the best results (Table 1c).
      3. Under external benchmark AgentLAB task injection, CoER achieves an ASR of 14.12% and Safe-U of 77.13% (Table 2, Table 13); under InjecAgent basic payloads, it achieves 0.00% ASR (Table 14).
      4. Against 8 cumulative attempts from 4 historical attackers, CoER maintains a joint ASR of 4.97% (Table 8); in post-hoc unilateral attacker reinforcement learning, the attacker's highest ASR is only 0.59% (Figure 5).
    • Conclusion and implications: The authors believe that adversarial co-evolution can effectively expand the attack and defense strategy space, and combining adaptive attack discovery with validated teacher demonstrations provides a feasible path for agent security defense in complex tool invocation scenarios.

Related papers

Show 3 more papers
Read originalarxiv.org