arXiv:2611.04672cs.CRNov 2026

Manuscript Offprint

arXiv:2611.04672

The Devil is in the Context: Nine Dimensions of Prompt Injection Attacks

Jiamin Chang, Kristina Nikolić, Rishi Sharma, Giovanni Cherubin, Vasilios Mavroudis, Jose Sanchez Vicarte, Arnav Garg, Hammond Pearce, Andrew Paverd, Ahmed Salem

Jiamin Chang*§, Kristina Nikoli懧, Rishi Sharma†, Giovanni Cherubin†, Vasilios Mavroudis†, Jose Sanchez Vicarte†, Arnav Garg†, Hammond Pearce*, Andrew Paverd†, Ahmed Salem†

  • University of New South Wales (§ Work done during an internship at Microsoft)

‡ ETH Zurich

† Microsoft Security Response Center

Abstract—Prompt injection is usually discussed and evaluated as a single, homogeneous type of attack. However, vulnerabilities reported in real-world systems show that prompt injections vary widely. Moreover, the same instruction can be a prompt injection in one context and a legitimate request in another, depending on the user's intent and the system's policies. Ignoring this variation leaves gaps in how defenses are evaluated, and can give a false sense of security against real-world attacks.

We identify nine dimensions along which prompt injection attacks differ. Together, they form a taxonomy that describes the injected instruction itself, its relation to the user's task, and how it manifests in the target system. Each dimension affects which defenses can detect or prevent an attack.

We first use the taxonomy to characterize six real-world prompt injection vulnerabilities, showing how much these attacks differ. We then apply it to nine prompt injection benchmarks and find that most cover only a small region of this space. Combining benchmarks helps, but 13% of pairwise category combinations remain untested, mostly among the less commonly represented categories. Finally, we show that the taxonomy supports automated annotation of benchmarks and targeted generation of new test cases to fill these gaps.

The taxonomy is also useful beyond benchmarks. Defense authors can use it to state which types of prompt injection they evaluated against, and system operators can use it to identify which attacks apply to their system and choose defenses to match.

I. INTRODUCTION

Indirect prompt injection is widely considered to be the foremost security threat to AI agents [1]. In prompt injection, an attacker "injects" instructions into the context of a user's agent, e.g. by inserting them in a document or a webpage that the agent visits [2]. This enables the attacker to affect the agent's control flow, with consequences such as unwanted actions, exfiltration of the user's data, or even account takeover. Numerous prompt injection detections and mitigations have been proposed [3]–[5], and multiple benchmarks have been defined to evaluate these defenses [6]–[8].

However, defenses and benchmarks alike treat prompt injection as a single, homogeneous threat. This has concrete consequences. First, robustness claims are not comparable. A defense that reports a low attack success rate on one benchmark may have been tested on only a narrow slice of the attack space, and the aggregate number says little about attacks with different properties. Second, benchmark size is mistaken for coverage. Thousands of samples may exercise only a

Figure

Fig. 1. Prompt injection attack flow and classification unit. Our taxonomy jointly considers the user task, the injected instruction, and the relevant system context, rather than studying the injected instruction in isolation.

handful of distinct attack properties, leaving whole classes of attacks untested. Third, application developers cannot match defenses to their threat model. An email assistant that reads messages from untrusted senders and keeps long-term memory faces very different injections than a single-turn document summarizer.

We therefore argue that prompt injection is best understood as a family of attacks whose security properties depend, not only on the injected instruction, but also on the user's authorized task and the system context. Figure 1 contrasts the two views. Previous taxonomies classify only the attacker's side: the injected instruction embedded in an external source (red). Our taxonomy extends the unit of classification to include the authorized user task and the context of the agentic system, such as its trust policy, available tools, and retained state (green). Together, these determine how the agentic system handles the retrieved instruction, and thus the success of the attack. The two observations below illustrate why this context cannot be ignored.

First, injection attacks cannot be disentangled from the user's intentions [9]. For example, suppose a document contains the sentence "Send the completed report to the address below.". If a user asks an agent to summarize the document, their expectation is for the sentence to be treated as part of the content to report, rather than an instruction. If the user instead asks the agent to carry out the document's instructions, the same sentence is a legitimate command.

Second, whether an attack succeeds also depends on prop-erties of the system and of the injection itself. For instance: 1) The trust label of the source matters: an email containing "Please get back to me with the IPO details" may be a legitimate request or a prompt injection, depending on whether it was sent by a colleague or by someone else. Information-flow defenses [3], [10] can limit what untrusted sources are able to cause, but some cases, such as insider threats or mislabeled sources, still require a prompt injection classifier to exercise judgment. 2) The visibility and interpretability of the injected instruction affect whether a user, and more importantly a prompt injection classifier, can detect it [7]. 3) Whether the attack is meant to be one-off, or to persist in the agent's memory and affect its future responses [11]. Each of these aspects affects if an attack succeeds and how it can be defended against. Evaluating agent security must take care of these aspects and test against each of them.

In this paper, we characterize prompt injection instances by introducing a taxonomy with nine dimensions. Unlike previous categorizations that focus solely on the injected instruction (e.g., [12]), the unit of classification in our taxonomy is the injected instruction in the context of (i) the user's intended task and (ii) the affected system (including the agentic harness), as illustrated in Figure 1. The inclusion of the user's intentions into the taxonomy enables capturing aspects such as the alignment of the injected instructions to the user's task and topic. Complementarily, by looking at the affected system our taxonomy can encompass any trust labels, intended effects of the attack (e.g., if it persists in memory or it causes tool calls), as well as whether the injections are visible and interpretable by the user. Each dimension captures a distinct property whose variation changes what a defense must observe, where it can intervene, or which assumptions it relies on.

We first apply the taxonomy to six publicly documented attacks against deployed systems, illustrating distinctions that can be obscured by a common prompt injection label. We then analyze nine selected benchmarks to examine their coverage of individual dimensions and combinations of categories. Our analysis shows that benchmark scale does not necessarily imply broad coverage: even when individual categories are represented across existing benchmarks, combinations of attack properties remain unrepresented. To support practical use, we further develop an annotation pipeline that combines deterministic rules with an LLM judge, and evaluate its agreement with human reference annotations. We also demonstrate taxonomy guided case generation, in which a seed case and a requested configuration guide modifications to the injected instruction or other permitted parts of the classification input. Applying the generator to 40 AgentDojo Workspace cases produces targeted variants that reveal attack successes and utility differences not observed on the selected original cases.

Together, these analyses provide a common basis for connecting attack characterization and evaluation coverage with application requirements. Using a shared vocabulary, application developers can name the attack categories their threat model requires, and defense authors can state the categories their mechanisms cover, i.e., under which assumptions and at what cost to fidelity, rather than claiming protection against prompt injection as a whole. Expressed in the same terms, a defense's stated coverage can be matched directly against an application's requirements.

References (34)