arXiv:2610.32531cs.CROct 2026

Manuscript Offprint

arXiv:2610.32531

On Task, Off Track: Benchmarking LLM and Agent Robustness to Near-Target Prompt Injection

Yuyang Gong, Zihao Wang, Jiawei Liu, XiaoFeng Wang

Yuyang Gong 1,†^{1,\dagger}, Zihao Wang 1,†^{1,\dagger}, Jiawei Liu 2^{2}, XiaoFeng Wang 1^{1}

1^{1}Nanyang Technological University

GONG0114@e.ntu.edu.sg, {zihao.wang, xiaofeng.wang}@ntu.edu.sg

2^{2}Wuhan University

laujames2017@whu.edu.cn

Abstract—Prompt injection benchmarks assess whether large language models (LLMs) and agents resist malicious instructions embedded in external content. However, a system could perform well by rejecting attacks that obviously abandon the user's request, while still accepting changes that retain most of a legitimate answer but make it incorrect or harmful. Testing more instructions for unrelated outcomes would not necessarily reveal this weakness. We call attacks seeking responses designed to resemble legitimate answers while introducing incorrect or harmful changes near-target prompt injection.

We introduce NTBench, the Near-Target Benchmark, which builds on legitimate tasks from existing datasets. For each task, a legitimate reference outcome guides the generation of target-instruction pairs, with separate tracks targeting incorrect and harmful outcomes in responses or agent tool invocations. Harmful targets can also accompany otherwise correct task completion. We combine LLM-based checks with human validation of the intended deviations, then assess whether injected instructions induce them using response judgments or tool-call checks, excluding deviations already observed without injection. We evaluate seven LLMs on ten datasets for language tasks and two agent benchmarks. Under a common budget of three attack executions per sample, both tracks achieve higher overall attack success rates than the fixed-target baseline for every evaluated model in each setting. On language tasks, the increases range from 9.3 to 35.8 percentage points for incorrect targets and 1.7 to 17.3 percentage points for harmful targets. These results show that resistance to the tested fixed-target attacks does not imply resistance to related incorrect or harmful outcomes, and that reference-guided targets broaden the failures revealed by robustness evaluation.

1. Introduction

Large language models (LLMs) and agents increasingly process retrieved documents, external messages, and tool outputs to complete user tasks [8], [9]. Here, a task consists of a legitimate user request together with the original information and, for agents, the environment and tools available

Figure

Figure 1: An example of near-target prompt injection targeting responses that resemble the legitimate answer but contain factual errors or disclose private information.

to carry it out. Completing such a task requires answering the user's question or performing the requested actions while following system instructions. Although external materials provide information needed for task completion, instructions within them are not authorized to override the user's request or system instructions. Prompt injection attacks attempt to cross this boundary by embedding malicious commands in untrusted content to manipulate answers, disclose private information, or induce unauthorized actions [12], [17], [33]. Such injections can be constructed using handcrafted templates [12], [24], gradient-based optimization [22], or LLM-guided generation and iterative refinement based on feedback from the target system [10]. Defenses aim to prevent this redirection through malicious-content detection [19], [26], instruction-following training that teaches models to distinguish trusted instructions from untrusted data [3], [4], [5], and agent harnesses that isolate execution, constrain information flow, or enforce security policies on tool use [2], [7], [30]. To assess robustness against these attacks, benchmarks evaluate instruction following in language tasks such as question answering and summarization [31], [37], as well as task completion in agent workflows involving tool use and environment interaction [8], [35]. These evaluations also encompass open-ended agent tasks that require dynamic planning and contain useful third-party instructions [15]. Unified evaluation platforms support systematic comparison of attacks and defenses across these settings [10].

†^{\dagger}The first two authors contributed equally to this work.

Legitimate response Incorrect or harmful target Tested attack target

Figure

(a) Desired boundary. Permit legitimate responses while resisting incorrect or harmful targets, including task-related deviations.

Figure

(b) A flawed boundary can look robust. With tests covering only distant attack targets, the model can pass every test shown while leaving task-related deviations untested.

Figure

(c) Since testing all possible attack targets is infeasible, NTBench constructs a set of incorrect or harmful targets around a legitimate response to evaluate robustness for the given task.

Figure 2: An illustration of how near-target probes can reveal vulnerabilities missed by evaluations focused on distant targets.

A gap in robustness evaluation. Robustness to prompt injection means completing the user's legitimate request without being redirected into producing incorrect or harmful answers or taking unauthorized actions. Low attack success rates provide evidence of resistance to the evaluated attacks. However, a system may pass these tests because it rejects the particular outcomes the attackers tried to induce, while remaining vulnerable to other incorrect or harmful outcomes. Each attack involves both an attack target, the response or action the attacker seeks, and an injected instruction intended to induce it. Searching for more effective instructions explores how a selected target might be induced. It does not establish whether a different target would be easier to induce. An evaluation can therefore test many instructions while leaving important attacker-desired outcomes unexplored.

One possibility is that a system rejects instructions that obviously abandon the user's task while accepting changes that appear relevant to it. Consider the task in Figure 1. A user requests a public workshop announcement based on planning notes, with private contact information omitted. The notes specify a 10 a.m. starting time and Room 3 venue. An attacker could append an instruction to the notes asking the assistant to abandon the announcement and print HACKED. Alternatively, the instruction could ask for an announcement that changes the starting time to 11 a.m. while preserving the remaining content. The first target obviously abandons the task. The second is still an announcement, but falsely states that the workshop starts at 11 a.m. Under the hypothesized rule, the altered announcement could therefore be easier to induce. We call attacks seeking responses designed to resemble legitimate answers while introducing incorrect or harmful changes near-target prompt injection.

Figure 2 illustrates why such failures can be missed, using schematic boundaries between responses a system allows and those it prevents. The desired boundary in (a) allows legitimate responses while excluding incorrect or harmful alternatives, including those that resemble legitimate answers. The flawed boundary in (b) also rejects targets that obviously abandon the task, but allows some incorrect or harmful responses that retain much of the legitimate content. Tests that examine only the distant targets can therefore make these two boundaries appear equally effective.

Our benchmark. An evaluation must therefore test whether a system rejects incorrect or harmful changes even when the resulting response still looks appropriate for the user's task. A legitimate answer provides a starting point for constructing such tests without trying to cover every possible attack target. We introduce NTBench, the Near-Target Benchmark, a red-teaming benchmark built on legitimate tasks from existing datasets. For each task, it constructs a set of attacks targeting incorrect or harmful deviations from legitimate behavior. As illustrated in Figure 2(c), each set uses a legitimate response as a reference for proposing related targets that could expose failures missed by tests focused on distant targets. For all attacks in a set, the system is still expected to fulfill the same user request and follow the same system instructions.

NTBench includes two tracks. The incorrect-target track stress-tests resistance to attacker-induced errors, such as changing the announcement's starting time in Figure 1. The harmful-target track tests outcomes that are themselves harmful, whether through generated content or actions taken by an agent. In the same example, an otherwise accurate announcement could disclose the organizer's private phone number despite the user's instruction to omit it. This track uses harmfulness criteria informed by official OpenAI and Anthropic policies [1], [21].

To construct each set, we use an LLM to generate target responses together with instructions intended to induce them. The generation prompts ask for responses that retain much of a legitimate answer while introducing an error or a harmful outcome, depending on the track. However, changing a legitimate answer does not necessarily make it incorrect or harmful: the result could be a paraphrase or another valid answer. We therefore combine LLM-based checks with human validation of whether generated targets are incorrect or harmful for the original task. The injections are placed in untrusted data supplied to an LLM or encountered by an agent during tool use.

Figure

Figure 3: Comparison of overall attack success rates (ASR@3) across models in the Language-Task and Agentic-Task settings: fixed-target, near-target-incorrect, and near-target-harmful.

Confirming that a target is incorrect or harmful does not show that an injection can induce it. We therefore assess whether the evaluated system follows the injected instruction using response judgments or tool-call checks, depending on the target. We exclude deviations already observed in an attack-free run and report the fraction of evaluated samples for which at least one attack succeeds within the allowed budget. The opportunities for an attack depend on what the user asks the system to do, what information it processes, and which tools it can use. These rates therefore describe vulnerability for the selected tasks, the attacks generated for them, and the number of attempts allowed.

Empirical results. We evaluate NTBench using seven LLMs on language tasks from ten datasets and agentic tasks from AgentDojo and AgentDyn. Attack sets are fixed before evaluation and shared across models, with a common budget of three attack executions per sample. As shown in Figure 3, both near-target tracks achieve higher overall ASR@3 than the fixed-target baseline for every evaluated model in each setting. On language tasks, incorrect-target and harmful-target ASR@3 exceed the baseline by 9.3–35.8 and 1.7–17.3 percentage points, respectively. This gap persists for Meta-SecAlign-70B, which is specifically trained to resist prompt injection: its ASR@3 rises from 3.2% for the baseline to 36.7% for incorrect targets and 18.4% for harmful targets. These results show that resistance to the tested fixed-target attacks does not imply resistance to related incorrect or harmful outcomes, even without model-specific adaptive search or a larger attack-execution budget. The two tracks also yield different model rankings, further showing that the outcomes selected for testing shape both the vulnerabilities revealed and the relative robustness attributed to different systems.

Contributions. Our key contributions are outlined below:

• An evaluation perspective. We examine whether reference-guided attacks seeking task-related incorrect or harmful outcomes expose failures left unobserved by the evaluated fixed-target attacks.

• A new benchmark. We present NTBench, which extends legitimate tasks from existing datasets with sets of attacks targeting incorrect or harmful deviations. Its two tracks check that the targets are incorrect or harmful and test whether injected instructions can make the system follow the attacker's request.

• An empirical evaluation. We evaluate seven LLMs on language tasks from ten datasets and agentic tasks from two benchmarks. Under a common attack-execution budget, both near-target tracks expose vulnerabilities left unobserved by the evaluated fixed-target attacks, showing that resistance to these baselines does not imply resistance to related incorrect or harmful outcomes.

References (35)