Skip to content

AdaLCPI: Making agents reconstruct indirect prompt injection from long-context fragmentsDivide and Inject: Can Agents Reconstruct an Indirect Prompt Injection from Fragments?

arXiv: Agent & MCP Security· arXiv:2609.36576· Michael Lee, Zhipeng Wei, Yue Dong, N. Benjamin Erichson·Indexed by this site · 2026-09-30· Originally publishedAttacks

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose AdaLCPI: decomposing the malicious goal into incomplete fragments and adaptively optimizing them, achieving a macro-average ASR of 61.4% across seven models with 8k filler, higher than Trojan Hippo-style's 32.8%.

Threat modelThe attacker controls external content returned by tools (emails, repositories, or Slack messages), and cannot modify the user task, system prompt, model weights, available tools, or other environment. During optimization, it is black-box: it can repeatedly execute and observe tool calls, parameters, and the final environment state, but cannot see parameters, gradients, or hidden activations. The goal is to induce unauthorized actions while completing benign tasks.

Questions
When tool-based agents assemble information from long contexts, attackers may not need to place complete malicious instructions; they can scatter incomplete fragments in retrieved content and let the agent reconstruct and execute them.
Methods
AdaLCPI splits the attack target into two incomplete fragments plus a reconstruction prompt, embeds them in long filler retrieved by tools, and uses OpenEvolve to iteratively rewrite the fragments and prompt based on graded scores and natural-language execution feedback.
Experiments and results
Under 8k filler, the seven-model macro-average ASR is 61.4%, higher than Trojan Hippo-style's 32.8% and AgentVigil's 30.0%; ablations state that fragments are strongest when combined with long context, and when split across different tool outputs the macro-average still reaches 40.7%.
Limitations and future work
The authors state the results do not show that this behavior generalizes to more frontier models or other agent architectures, and plan to continue testing on broader models, stronger defenses, and other tool and retrieval settings. The experiments cover seven models and three environments, with 81 task–target pairs per model per condition.
Experimental setupGPT-4.1、GPT-5.1 et al. · Email、GitHub et al. · ASR、Utility(benign task completion under attack)
Evaluated models
GPT-4.1GPT-5.1GPT-5.6-LunaQwen-3.6-27BMinistral-3-14BGemma-4-31BMuse-Glimmer-30B
Benchmarks
EmailGitHubSlack
Metrics
ASRUtility(benign task completion under attack)
AI summaryThe researchers propose AdaLCPI, an adaptive long-context prompt injection method that splits the attack target into incomplete fragments embedded in external content retrieved by the agent's tools, then uses reconstruction cues to guide the agent in combining them, and leverages OpenEvolve to iteratively optimize the fragments and cues based on scores and natural language execution feedback.

The researchers propose AdaLCPI, an adaptive long-context prompt injection method that splits the attack target into incomplete fragments embedded in external content retrieved by the agent's tools, then uses reconstruction cues to guide the agent in combining them, and leverages OpenEvolve to iteratively optimize the fragments and cues based on scores and natural language execution feedback.

Related events and news

2 events · 1 news mentions

News that mentions this paper

Adversa AI 汇总 10 月 AI Agent 安全资源

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Whether an attacker can, using only incomplete fragments in a long context, cause a tool-based agent to reconstruct and execute a malicious goal.

    Whether tool-based agents can assemble incomplete fragments scattered across a long context into an executable malicious instruction and take unauthorized actions through tools.

    • Scenario: The authors state that reasoning and long-context retrieval capabilities allow agents to gather external content before deciding actions; tool-retrieved content introduces an indirect prompt injection surface. The question is whether an attacker must hand the full malicious instruction to the agent.
    • Limitations of existing methods: The authors state that Liu et al. (2024b), AgentVigil, RL attackers, adaptive attacks against defenses, and Trojan Hippo all optimize attacks where "the malicious instruction is explicitly given," without asking whether the agent must receive the full instruction.
    • Core observation: The authors cite Fu et al. (2026), stating that harmful requests can be split into incomplete fragments scattered across a long context, and models may refuse the same request stated directly yet execute the assembled request. They argue that on tool-based agents, fragments can also be placed in external content, reconstructed by the agent, and then executed via tools.
    • This paper proposes: Adaptive long-context prompt injection (AdaLCPI). It decomposes the attack goal into incomplete fragments, embeds them in tool-retrieved external content, adds a reconstruction cue, and then uses OpenEvolve to iteratively rewrite fragments and the cue based on graded scores and natural language execution feedback from the target agent.
    • Threat model:
      • Victim system: An agent A using a fixed toolset, receiving a trusted benign user task u, interacting with environment E through tools; the execution trajectory includes tool returns and tool calls with parameters, and the environment updates to a final state.
      • Attacker capabilities: Controls the injected payload p, placing it in external content the agent may retrieve (email, repository content, or Slack messages); cannot modify the user task, system prompt, model weights, available tools, or the rest of the environment.
      • Access during optimization: The authors state this is black-box evaluation access. The attacker can repeatedly execute candidate payloads and observe trajectories and final states, without seeing model parameters, gradients, or hidden activations; the optimized payload is placed back into the same type of external content.
      • Goal and success: Induce unauthorized actions while completing u. Example goals g include sending protected information to an attacker-controlled recipient, or deleting a specified resource. Success is determined by Gg(τ, ET)=1, based on tool calls, parameters, and final environment state; intermediate progress scores in the search do not count as success.
  2. What related research exists?

    The authors position AdaLCPI along three lines: indirect injection on agents, adaptive attacks, and long-context fragment attacks.

    Indirect prompt injection on agents

    • Perez & Ribeiro (2022), Greshake et al. (2023): Prompt injection uses attacker-controlled text to steer the model away from user intent; indirect prompt injection extends the threat to external content the model reads later, without requiring direct access to the model.
    • InjecAgent (Zhan et al., 2024), AgentDojo (Debenedetti et al., 2024): The former evaluates this setting across many tools and attack targets; the latter provides a dynamic environment and measures both utility and safety under indirect prompt injection. The authors state these works establish this paper's threat model: the attacker controls external content, not the user task.

    Adaptive prompt injection

    • Liu et al. (2024b), AgentVigil (Wang et al., 2025), RL-Hammer (Wen et al., 2025): Gradient methods generate universal prompt injections transferable across inputs; AgentVigil uses black-box search to iteratively rewrite indirect injections targeting tool-based agents; RL-Hammer trains an attacker model with reinforcement learning.
    • Nasr et al. (2026), Trojan Hippo (Das et al., 2026), IterInject (Chen et al., 2026), AgentLAB (Jiang et al., 2026): Attacks tailored to defenses can outperform static attack suites; Trojan Hippo uses OpenEvolve to optimize persistent attacks against agent memory; IterInject uses feedback from failed attacks to rewrite indirect injections; AgentLAB targets long-horizon agents using memory and tools. The authors state AdaLCPI follows the adaptive setting but optimizes incomplete fragments and reconstruction prompts.

    Compositional, long-context, and multi-turn attacks

    • Zhang et al. (2026), Fu et al. (2026), Context Stitching (Karanjai et al., 2026): Harmful intent is split across multiple pieces of information; compositional reasoning attacks require the model to retrieve and merge fragments in long contexts; Context Stitching splits injections across multiple safety logs and relies on the model to merge them across contexts.
    • Xiong et al. (2026), MT-AgentRisk (Li et al., 2026), persistent memory attacks (Das et al., 2026): In capability-constraint studies, a single observation is insufficient for a violation, and harm only emerges when combined; MT-AgentRisk converts single-turn harmful tasks into multi-turn sequences for tool-based agents and finds that safety can degrade across turns; persistent memory attacks show that attacker-controlled information can influence behavior long after entering the system.

    Baseline methods and evaluation environments

    • Baselines: Trojan Hippo-style (same adaptive search, graded scoring, and natural-language feedback, but the malicious instruction remains explicit and no filler is added), non-adaptive long-context fragmentation LCF (Fu et al., 2026), TAP (Hofer et al., 2026; Mehrotra et al., 2024), AgentVigil, IterInject.
    • Environments: Email, GitHub, Slack. Each environment has three benign tasks, and each task has three attack targets in each of three categories: data exfiltration, reputation damage, and data deletion.

    The authors position this paper as: connecting Fu et al. (2026)'s fragmented long-context attack to tool-based agents, and using the target agent's execution feedback to revise fragments and reconstruction prompts; compared with the adaptive attacks of Wang et al. (2025) and Chen et al. (2026), the optimization target changes from explicit complete instructions to incomplete fragments plus reconstruction prompts.

  3. How does the paper address this problem?

    AdaLCPI uses two incomplete fragments plus a reconstruction prompt, then searches with OpenEvolve based on execution feedback.

    AdaLCPI writes malicious instructions as incomplete fragments embedded in long retrieved content, then rewrites these fragments and the reconstruction cue based on the target agent's execution trajectories. Figure 2 summarizes: decompose the goal, embed the long-context payload, execute, and adaptively optimize.

    Problem Setting and Fragment Representation

    • Execution: After placing payload p into attacker-controlled content, the environment is denoted E[p]; a run is written as (τ, ET)=Run(A, u, E[p]). The full malicious instruction is denoted mg; conventional indirect injection can place mg directly into content, while AdaLCPI splits the information needed to implement mg.
    • Candidates: Given a goal g, a candidate is x=(f1, f2, c). The authors choose two fragments, calling this the simplest setting requiring merging independent information. The two fragments share a label, and the reconstruction cue requires locating, merging, and executing the assembled instruction, without writing out the full malicious instruction alone.
    • Legality: Each fragment contains only part of the action, goal, tool, or data; the reconstruction cue only explains how to locate and merge, and must not introduce goal-related actions, goals, tools, or data. Together they must be sufficient to reconstruct an executable instruction. Candidates containing the full malicious instruction are rejected.
    • Long-context embedding: Fragments are inserted into filler hL, where L is the number of added filler tokens, not the total payload length. The insertion positions are ρ=(r1, r2), and the payload is pL(x; ρ)=Insertρ(hL; f1, f2) concatenated with c. The cue follows the filler, so the agent encounters the two fragments before being asked to merge them. Positions are sampled once at the start of each optimization, and positions and filler are fixed; the search only changes f1, f2, and c.

    Search Objective and Feedback

    • Objective: Maximize Jg(x) over the legal set Xg, i.e., x⋆ ∈ arg max Jg(x). Success is still counted only when Gg(τx, ExT)=1; the score only guides the search.
    • Graded score: On success, Jg(x)=10; otherwise Sg(τx, ExT)∈{1,…,9}. Low scores correspond to attacks with almost no effect, medium scores to partial reconstruction or use of injected information, and high scores to attempts that fail due to tool, goal, or parameter errors. The Judge also provides natural language feedback explaining what happened and how to improve.
    • Mutator: The LLM Mutator reads the selected candidate, graded score, natural language feedback, and tool call summary, and can change the division of the goal between the two fragments, the fragment wording, and how the reconstruction cue refers to these fragments.

    OpenEvolve Search

    • Archive: The quality-diversity archive uses two features: payload length and edit distance from seed x0, each divided into 8 bins, giving an 8×8 archive, using a single island. The seed plus 8 structurally different variants initialize it.
    • Iteration: Each round selects 4 parents from the archive, and the Mutator proposes 6 new candidates; each candidate is embedded at fixed positions, executed on the target agent, scored by the Judge, and written back to the archive. The appendix states that parents are half elite and half non-elite (elite ratio 0.5).
    • Stopping and budget: At most K=20 rounds; early stopping occurs if success appears or the best Jg(x) shows no improvement for P=8 consecutive rounds. With 9 initial candidates plus at most 6 per round, a single search uses at most 129 target agent executions. Parameters are fixed at n0=8, np=4, nc=6, K=20, P=8.
    • Constraints and models: The Mutator's system prompt requires that no single fragment contain the full malicious instruction, and the reconstruction cue must not introduce goal-specific information; the Judge receives the same constraints. The Judge is GPT-4o, the Mutator is GPT-4.1, with a generation length limit of 8192 tokens and temperature 0.8. Appendix A.3 gives the full prompts.

    Initialization, Two-Stage Evaluation, and Success Determination

    • Initialization: The Decomposer constructs seed x0 from the attack goal; the Generator (GPT-4.1, temperature 1.0) then generates 8 structurally different variants, totaling 9 candidates. Both are used only for initialization.
    • Two-stage Judge: The first stage uses GPT-4o at temperature 0.0, making a binary success determination based on the trajectory and post-execution environment state; on success, it records 10 points and skips the second stage. Only on failure does it enter the grading stage (GPT-4o, temperature 1.0), giving a 1–9 score and natural language feedback. The reported ASR is determined solely by binary success.
    • Goal decoding: The target agent interface exposes temperature 0.6 when available. ASR is the proportion of task–goal pairs achieving the specified attack goal; macro-average weights models equally. Utility is the proportion of original benign tasks completed, based on trajectory and final state.
    • Split tool output variant: Fragments are placed in different tool outputs, filler is distributed, each fragment is repeated three times within its output; the first output has a short lead-in, and the reconstruction cue is in the last output. Neither the lead-in nor the cue contains goal-specific actions, goals, tools, or data, and the lead-in, fragments, and cue are jointly optimized.
  4. What experiments did the paper conduct?

    Under 8k filler, AdaLCPI macro-average ASR is 61.4%, higher than the explicit-instruction baseline with the same search at 32.8%.

    Experimental setup

    • Models: GPT-4.1, GPT-5.1, GPT-5.6-Luna, Qwen-3.6-27B, Ministral-3-14B, Gemma-4-31B, Muse-Glimmer-30B, seven in total.
    • Environments and scale: Email, GitHub, Slack. Each environment has 3 benign tasks; each task has 3 attack targets in each of data exfiltration, reputation damage, and data deletion, i.e., 27 pairs per environment and 81 pairs per model per condition. The attacker controls emails, repository content, or Slack messages.
    • Baselines: Trojan Hippo-style (same target configuration, tasks, targets, adaptive search, graded scoring, and natural-language feedback, but the malicious instruction remains explicit and no filler is added); LCF (long-context fragmentation without adaptive optimization); TAP; AgentVigil; IterInject. AdaLCPI filler lengths are 2k, 4k, 8k, and 16k tokens.
    • Metrics: ASR is the proportion of task–target pairs that achieve the specified attack target; intermediate progress scores do not count as success. Macro-average weights models equally. Utility is the proportion of benign tasks completed under AdaLCPI-8k. In Table 1, Δ is the difference between the best AdaLCPI and the stronger of TAP, Trojan Hippo-style, AgentVigil, and IterInject.
    • Evaluation: Binary success is determined by the first-stage Judge (GPT-4o, temperature 0.0) based on tool calls, parameters, and final environment state. The paper does not report agreement with human judgment.
    • Search budget: Unless otherwise noted, the configuration is fixed: at most 20 rounds, 6 new candidates per round, at most 129 target executions, and early stopping after 8 consecutive rounds without improvement in the best graded score. The four conditions in Table 3 are optimized independently with the same search budget.

    Main results

    According to Table 1, ASR (%) and benign-task completion rates under AdaLCPI-8k are as follows.

    Swipe horizontally to read the table

    ModelHippoLCFAdaLCPI-8kUtility-8k
    GPT-4.156.82.558.042.0
    GPT-5.146.93.765.453.1
    GPT-5.6-Luna1.20.08.666.7
    Qwen-3.6-27B9.94.971.653.1
    Ministral-3-14B54.33.761.725.9
    Gemma-4-31B37.013.691.446.9
    Muse-Glimmer-30B23.57.472.858.0
    Macro avg.32.85.161.449.4
    • Authors' interpretation: Relative to Trojan Hippo-style, AdaLCPI-8k achieves higher ASR on all seven models, but the gains vary; for example, Qwen-3.6-27B goes from 9.9% to 71.6%, and GPT-4.1 from 56.8% to 58.0%. The gap between LCF and AdaLCPI is used by the authors to argue that fixed fragmentation alone cannot explain the improvement.
    • Exceptions: In Table 1, TAP on Ministral-3-14B is 84.0%, higher than its AdaLCPI-8k of 61.7%, with Δ of -21.0; GPT-4.1 at 16k is 66.7%, equal to TAP, with Δ of 0.0. On macro-average, AdaLCPI-8k is 61.4%, TAP 26.3%, AgentVigil 30.0%, and IterInject 32.6%.
    • Environments and categories: In Table 2, the difference between AdaLCPI-8k and Hippo is Email +38.1, Slack +39.2, and GitHub +8.5 percentage points; across the three categories, data exfiltration is 66.1% (+27.5), reputation damage 54.5% (+34.9), and data deletion 63.5% (+23.3). The authors state that in finer environment–category breakdowns, the only exception is GitHub data exfiltration, where Hippo is higher (see Appendix Tables 8 and 18). Figure 6 labels Email data exfiltration as 79.4%, the highest environment–target combination in that figure.

    Fragments, filler, and reconstruction prompts

    • What was tested: Table 3 independently optimizes complete instructions and "fragments+cue" at 0k and 8k filler on the four models with the largest gains in Table 1.
    • Results: At 0k, Hippo-style macro-average is 29.3% and fragments+cue is 0.0%; at 8k, they are 25.3% and 75.3%, respectively. The authors state that at the same 8k length, the fragment representation averages 50.0 percentage points higher than complete instructions, and neither fragmentation alone nor long-context embedding alone reproduces the gain when both are combined.
    • Removing fragments: Table 4 removes fragments from already successful AdaLCPI-8k attacks without further optimization, evaluating only the task–target pairs where the original attack succeeded, replacing the removed parts with neutral filler of equal length, and repeating each pair three times. When only c is kept, all cells are 0.0%. When one fragment plus c is kept, the authors report model–environment combinations ranging from 0.0% to 29.3% (Gemma-4-31B, Email, f2+c at 29.3%). The authors state that the prompt alone cannot reproduce the attack, but a single fragment retains enough information to succeed in some cases.

    Fragments across tool outputs and repeated searches

    • Across outputs: Table 5 places fragments in different tool outputs, with 8k total filler macro-average ASR of 40.7% and 16k of 47.6%. At 16k, six of seven models are nonzero; GPT-5.6-Luna is 0.0% at both 8k and 16k, Qwen-3.6-27B is 3.7% at both, and Ministral-3-14B is 96.3% at 16k. The authors state that this setting introduces both leading text and fragment repetition, and the results still show that the two fragments need not appear in the same retrieved content.
    • Repeated searches: The authors state that across four models and three seeds, AdaLCPI-8k's average ASR is higher than Trojan Hippo-style in all cases, with little variation across rounds (Appendix Table 13).
    • Benign tasks: In Table 1, the benign-task completion rate under AdaLCPI-8k has a macro-average of 49.4%, ranging from 25.9% (Ministral-3-14B) to 66.7% (GPT-5.6-Luna). The authors state that optimization targets only malicious goals, and agents still often complete benign tasks.

    Other ablations and analyses

    • Filler lengths in Table 1: macro-average ASR is 54.1% at 2k, 56.4% at 4k, 61.4% at 8k, and 60.8% at 16k; GPT-5.1 drops to 49.4% at 16k, below its 65.4% at 8k.
    • Figure 5: The authors state that by cumulative ASR over evaluated candidates, AdaLCPI is higher than Hippo-style for most of the search trajectory on six models; the main exception is GPT-4.1, where Hippo-style is stronger earlier in the search. Endpoint labels visible in the figure include 23.5%.
    • Figure 6: AdaLCPI-8k averages by environment are Email 69.8%, GitHub 59.3%, and Slack 55.0%; data deletion is 73.0% on GitHub and 54.0% on Slack.
    • Appendix Table 21 matches Table 5: with fragments across outputs, 8k/16k macro-averages are 40.7% / 47.6%.
    • GPT-5.6-Luna is low across all columns in Table 1: AdaLCPI-8k is 8.6%, 16k is 14.8%, and TAP, Hippo, AgentVigil, IterInject, and LCF are 2.5%, 1.2%, 0.0%, 1.2%, and 0.0%, respectively.
  5. What are some points that can be further explored?

    The authors believe that seven models and three environments are insufficient to show that this behavior generalizes to more frontier models and architectures.

    Limitations and Future Directions Noted by the Authors

    • Generalization scope: Limitations and future work states that the experiments cover seven models and three tool environments, and the results do not establish that the same behavior generalizes to more frontier models or other agent architectures.
    • Further testing: The same section states that a natural next step is to test AdaLCPI on a broader set of frontier models and stronger defenses (citing Bhagwatkar et al., 2025; Gong et al., 2026; Zhu et al., 2025).
    • Other tools and retrieval: The same section also states the need to study whether fragment-based attacks remain effective under other tools and retrieval settings.

    Experimental Coverage

    • Models and environments: Section 4 evaluates seven models across Email, GitHub, and Slack environments; each environment has 27 task–goal pairs, giving 81 pairs per model per condition.
    • Attack conditions: The main comparison includes TAP, Trojan Hippo-style, AgentVigil, IterInject, LCF, and AdaLCPI with 2k, 4k, 8k, and 16k filler; the fragment/full-instruction ablation in Table 3 uses the four models with the largest gains.
    • Defenses: The main experiments compare attack methods. The authors list testing against stronger defenses as future work in Limitations; the main experiments do not report ASR against these defenses.
    • Determination and repetition: ASR is determined by a GPT-4o binary Judge based on trajectory and final state; the paper does not report agreement between this Judge and human judgment. Repeated searches with three seeds are in Appendix Table 13, covering four models.
    • Split setting: Table 5 tests fragments across tool outputs, using both lead-in and fragment repetition; regarding search budget, Appendix Table 6 states that a single search uses at most 129 target agent executions.
  6. Summarize the main content of the paper

    AdaLCPI attacks tool-based agents with fragments plus adaptive search, achieving a macro-average ASR of 61.4% at 8k filler.

    AdaLCPI studies whether tool-based agents can reconstruct malicious goals from incomplete fragments in retrieved content and carry them out through tool actions.

    • Problem: Indirect prompt injection usually places complete malicious instructions in external content. The authors ask whether agents that rely on retrieval and merging will still execute instructions if they are split and scattered across a long context.
    • Method: Each candidate contains two incomplete fragments and a reconstruction prompt, embedded in fixed filler at fixed insertion positions; OpenEvolve searches with an 8×8 quality-diversity archive, a two-stage GPT-4o Judge provides scores from 1 to 10 and natural-language feedback, and a GPT-4.1 Mutator rewrites the fragments and prompt. Success is determined solely by whether the unauthorized target is achieved. The attacker has black-box execution access during optimization and controls only tool-readable external content at deployment.
    • Main results: Across seven models and 81 pairs per condition, AdaLCPI-8k macro-average ASR is 61.4%, Trojan Hippo-style is 32.8%, AgentVigil is 30.0%, and non-adaptive LCF is 5.1% (Table 1). Relative to Hippo-style, the 8k results are higher for all seven models; on Ministral-3-14B, TAP's 84.0% is higher than AdaLCPI-8k's 61.7%.
    • Ablations: On four models, fragments plus prompt achieve a macro-average ASR of 0.0% at 0k filler and 75.3% at 8k, while complete instructions achieve 25.3% at the same length (Table 3). Removing the fragments and keeping only the prompt yields no successes (Table 4). When fragments are placed across different tool outputs, the macro-average is 40.7% at 8k and 47.6% at 16k (Table 5).
    • Authors' conclusion: Malicious goals need not appear completely in attacker-controlled content; safety evaluation should check whether agents remain robust when they must reconstruct harmful goals from incomplete, scattered tool outputs. The authors also state that the current seven models and three environments are insufficient to show that this behavior generalizes to more frontier models or other agent architectures.

Related papers

Read originalarxiv.org