arXiv:2609.04495cs.AISep 2026

Manuscript Offprint

arXiv:2609.04495

Rethinking Indirect Prompt Injection as a Test-Time Search Problem

Duong M. Nguyen, Joon Sik Kim, Blazej Manczak, Vaikkunth Mugunthan

Abstract

We formulate indirect prompt injection as a test-time search over a task-dependent attack surface induced by the environment, user task, and injection task. To operationalize this formulation, we introduce an agentic attacker with a dedicated search harness that performs environment reconnaissance, structured reasoning over attack strategies, and adaptive evaluation using victim-agent feedback. Across heterogeneous tasks, we find that increasing attacker test-time compute improves vulnerability discovery and exploitation, while ablations show that explicit strategy management is important for avoiding redundant search and sustaining gains at larger budgets. These results suggest that agentic security evaluations should characterize both the attacker's search procedure and compute budget, rather than treating attack success as a budget-independent property of the victim. More broadly, our findings identify the attacker's adaptive search over the system attack surfaces as an important and underexplored security risk for tool-using agents.

1 Introduction

Large Language Models (LLMs) have rapidly advanced in their capabilities, enabling them to perform tasks such as content generation, question answering, tool calling, coding and many others [18, 15, 12]. This has paved the way for developing LLM-based agents that combine LLMs with tools and memory mechanisms capable of interacting with broader environments [17, 39, 30, 36, 3, 24]. From system perspective, an LLM-based agent [38] usually operates through several key steps when solving a task: ① Defining roles and behaviors via a system prompt. ② Receiving user instructions and task details. ③ Retrieving relevant information from external documents and channels via tool calls. ④ Planning based on the retrieved information and prior context. ⑤ Executing action using external tools.

This system viewpoint highlights a key security challenge that LLMs operate directly on text provided by external channels and tools, lacking a formal way to distinguish instructions from context data [31, 48]. Indirect prompt injection attacks exploit this vulnerability by inserting new malicious instruction in third-party data processed by the agent's tools (via step ③) [31, 43, 7], allowing external attacker to take actions (and call tools) on behalf of the user. Potential consequences include exfiltrating user data, executing arbitrary code, and more [10, 16, 22].

Importantly, these vulnerabilities are not fixed: they depend on the user task, attack objective, and attacker capabilities. Each user task induces a distinct benign tool-use trajectory, exposing different exploitable channels that define a task-dependent attack surface. The attacker then searches this surface for an injection that achieves the target malicious objective. From this perspective, indirect prompt injection can be naturally formulated as a search problem over an attack surface jointly defined by the user tasks and attack objectives. However, existing benchmarks [43, 7, 41, 9] typically frame indirect prompt injection as a static evaluation problem, thereby overlooking task-dependent

∗^{*}Work done at Dynamo AI.

†^{\dagger}Corresponding authors: nmduongg@illinois.edu, {joon,vaik}@dynamo.ai

Preprint.

Figure

Figure 1: We formulate agentic system vulnerabilities as a test-time search problem. a) We define the attack surface based on the environment and task compatibility. The attacker then iteratively refines attacks using feedback from the victim agent. b) The search harness has three main components: Exploring the Environment, Reasoning and Searching, and Evaluating and Feedback (see Sec. 2.2).

vulnerabilities induced by distinct agent interaction trajectories. Moreover, they generally do not characterize how attack effectiveness scales with test-time compute. Since additional test-time compute can substantially improve frontier models' performance on reasoning-intensive tasks [33, 37, 4], evaluations conducted under a fixed attacker compute budget may systematically underestimate the susceptibility of agentic systems to adaptive, search-based attacks.

To address these limitations, we formulate indirect prompt injection as test-time search over a task-dependent attack surface jointly induced by the user task and injection task (Fig 1a). We operationalize this formulation with an agentic attacker equipped with a search harness for adaptive exploration under varying compute budgets (Fig 1b). Our contributions are: (1) the first study of indirect prompt injection through the lens of scaling test-time compute (Sec.2.1); (2) an attack protocol based on an agentic attacker with a structured search harness for adaptive attack-space exploration (Sec.2.2); and (3) preliminary result that scaling attacker test-time compute improves vulnerability discovery and exploitation, revealing an underexplored security risk in agentic systems (Sec. 3).

References (51)