arXiv:2610.38867cs.AIOct 2026

Manuscript Offprint

arXiv:2610.38867

Where You Inject Matters: The Trust Region Effect in LLM Agents

Chengquan Guo, Xiaodong Liu, Weiwei Yang, Mingqian Feng, Jialin Song, Qiyao Ma, Carolyn Buractaon, Christopher White, Bo Li, Jianfeng Gao

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

LLM agents are increasingly adopted in long-horizon tasks and interact with diverse external environments. Despite their growing capabilities, these agents remain vulnerable to real-world attacks such as indirect prompt injections, which manipulate agents through malicious instructions embedded in external environments. While existing risk assessment work has primarily focused on the injection content, the effect of where an injection appears has not been systematically characterized. Studying injection placement requires agents to operate over longer-horizon tasks and interact with diverse environmental surfaces. Thus, we build three agentic testbeds spanning tool use, coding, and daily workflow domains with diverse injection surfaces. Holding the injection content fixed, we find that agent susceptibility varies across injection placements. We refer to this phenomenon as the trust region effect: agents implicitly assign different levels of trust to different regions of their environments. For example, an agent powered by GPT-5.4 follows an unsafe injection instruction placed in a repository documentation file (i.e., a README or TODO file) 2.6× more often on average than the same instruction placed in a code or data file. Building upon this observation, we develop learning-based attackers that generate injection content and select better injection placements. Our approach demonstrates that both where an injection is placed and what content it contains can affect the strength of indirect prompt injection attacks. To the best of our knowledge, this work provides the first systematic characterization for the effectiveness of different injection placements, spanning both coarse-grained environmental surfaces and fine-grained positions. The uneven trust that agents implicitly place across their environments provides important insights for future attack and defense design.

1 INTRODUCTION

LLM agents (Yao et al., 2023; Anthropic, 2025; OpenClaw, 2026) have become increasingly capable of performing complex tasks involving tool use, software engineering (Merrill et al., 2026), and everyday workflows such as email and message management. By interacting with external tools and environments, these agents can access and act upon additional information, substantially extending the capabilities of standalone LLMs. Despite this rapid progress in agentic capabilities, significant safety and security vulnerabilities remain. According to the OWASP Top 10 for LLM Applications (OWASP Foundation), prompt injection has remained the top-ranked security risk for LLM applications for two consecutive years (2025 and 2026), posing a major obstacle to the large-scale deployment of LLM agents in real-world organizations. Within prompt injection, indirect prompt injection is particularly concerning because unsafe instructions originate from external environments, such as documents, emails, or other tool-call results. In an indirect prompt injection attack, benign users neither provide nor even observe the unsafe instructions, yet the agent can still encounter the injection during task execution and be misled into following the attacker's intended behavior. This threat model is therefore realistic for deployed agents and can pose substantial real-world risks.

†Work done during an internship at Microsoft Research.

Figure

Figure 1: The same injection content can succeed or fail depending on its placement. During a benign coding-agent task, a GPT-5.4 agent with the OpenAI Agents SDK traverses multiple environmental surfaces, including README.md, TODO.md, source files, and data files. Holding the injection content fixed (CWE-78 Risk), the agent follows the instruction when it appears in README.md but ignores the identical instruction in a data file. This contrast motivates our study of injection placement and the trust region effect.

To better understand the vulnerability of AI agents to prompt injection, prior work has made substantial efforts to evaluate and improve prompt injection attacks. Existing benchmarks (Debenedetti et al., 2024; Zhan et al., 2024) evaluate how different injection contents, including direct malicious instructions and sophisticated attack prompts, affect attack success rates. Other methods (Wen et al., 2025; Chen et al., 2026a;b; Syros et al., 2026) develop red-teaming techniques to optimize injection content and construct more effective attacks. Also, several studies investigate indirect prompt injection in specific application domains; for example, Liao et al. (2025); Xu et al. (2024) focus on attacks against web agents. While injection content has been studied more extensively, the effects of different injection placements remain less understood. Prior work has examined placement only in restricted settings, such as positions within a webpage or a file (Liao et al., 2025; Hao et al., 2026), but it remains unclear how placement across heterogeneous environments affects attacks. From an attacker's perspective, a natural goal is to identify the most vulnerable placement for an injection, since different placements may yield different attack effectiveness due to their distinct semantic roles and contextual characteristics. For example, in a coding task, instructions appearing in a TODO.md file may be treated as more trustworthy than those in a data file. Fig. 1 illustrates this effect: the same injected instruction is obeyed when it is placed in a README.md file but ignored when placed in a data file, even though the agent reads the injected content in both cases.

To systematically study injection placement across heterogeneous environments, two challenges arise. First, studying placement across diverse environmental surfaces requires longer-horizon benign tasks in which agents naturally interact with multiple surfaces; otherwise, the space of possible injection surfaces is inherently limited. Second, a controllable platform is needed to support injecting instructions into coarse-grained environment surfaces and fine-grained positions within each surface. To address these challenges, we build 3 agentic testbeds spanning tool use, coding, and daily workflow domains, covering 36 distinct environmental surfaces and 24 risk categories. Our empirical study reveals several key findings. First, most failed indirect prompt injections are ignored rather than explicitly rejected. Second, with injection content fixed, agents exhibit different levels of susceptibility across environmental regions, revealing the trust region effect: agents appear to assign different levels of trust to different regions. Third, these trust patterns vary across agents. Fourth, even advanced models acting as red-teamers cannot reliably choose the most effective injection placements for attack. Building on the testbeds and findings, we further develop a learning-based attacker that optimizes both injection content and placement. Our results show that incorporating placement optimization further improves attack effectiveness over content-only optimization.

Our key contributions are summarized as follows: (1) We identify and systematically investigate a realistic yet underexplored dimension of indirect prompt injection attacks: injection placement. We characterize how different injection placements affect attack effectiveness across diverse agentic environments and show the trust region effect. (2) We build three agentic testbeds spanning 3 different domains and show that the trust region effect consistently emerges across different agents. Our findings reveal uneven agent robustness to prompt injections across different environmental regions. (3) We develop a learning-based attacker that optimizes both injection content and placement. Our approach demonstrates that incorporating the placement axis can further improve attack success over content-only optimization.