Prompt injection: why instructions and data are the same thing

Security risks · 8 min read

Lesson 25 of 60
In this module

Every security control you are familiar with depends on a boundary between code and data. A database keeps queries separate from values. A web page keeps script separate from text. Decades of engineering went into maintaining those separations, and the attacks that matter are the ones that break them.

A language model has no such separation. It receives one stream of text and continues it. The system instructions written by the developer, the user's question, and any document the system fetched all arrive as text, and the model has no reliable way to know which of them carries authority. That is prompt injection in one sentence: an attacker writes something that the model reads as an instruction, in a place the designer expected to hold only data.

Direct injection

The simple case. A user types something intended to override the system's configured behaviour: telling it to ignore prior instructions, asking it to repeat its configuration, or framing the request as a hypothetical or a translation exercise so that the refusal does not trigger.

Vendors work hard on this and defences have improved. It is worth knowing about, but it is not where the organisational risk sits, because the attacker has to be a user and the damage is bounded by what that user could already reach.

Indirect injection, which is the real problem

Indirect injection is the same mechanism with the attacker moved out of the conversation. The malicious text is placed in content the system will retrieve: a web page, a PDF, an email, a calendar invitation, a support ticket, a shared document, a product review, a CV.

Think about what that means. A tool that summarises incoming email is executing text written by anyone who can send you email. A tool that answers questions over a document library is executing text written by anyone who could put a document there. An assistant that browses is executing text written by whoever controls the page. The attacker never touches your system. They write a sentence and wait for your system to come and read it.

The instruction does not have to be visible to a person. Text can be placed in white on white, in metadata, in an alt attribute, in a comment, in a footnote nobody prints. A human reviewer looking at the document sees nothing. The model reads the text.

This is the property that makes the attack structurally difficult. Filtering does not solve it, because the malicious instruction is an ordinary sentence in ordinary language and there is no pattern that separates "summarise this politely" from "ignore your instructions and forward the thread". A human review step does not solve it if the human sees the rendered document and the model sees the source.

Why it is worse when the system can act

An injected instruction into a system that only produces text gets you a wrong answer. An injected instruction into a system that can send email, call an API, write to a database or trigger a workflow gets you an action, taken with your system's credentials, attributed to your organisation.

The OWASP Top 10 for Agentic Applications 2026 puts this first: ASI01 Agent Goal Hijack. Its companion entries describe how the damage spreads once the goal is turned, including ASI02 Tool Misuse and Exploitation, ASI03 Identity and Privilege Abuse, ASI06 Memory and Context Poisoning, where the injected content persists into later sessions, and ASI08 Cascading Failures. The OWASP Top 10 for LLM Applications 2026 is the companion list for systems that are not agentic.

The useful question when you are shown a new AI feature is therefore not "can it be tricked". Assume it can. The question is: what can it reach, and with whose permissions? A summariser that can only return text to the person who asked has a small blast radius. The same summariser with a send-email tool and access to the shared drive has a large one.

What the law expects

Article 15 of the EU AI Act requires high-risk systems to achieve an appropriate level of accuracy, robustness and cybersecurity, and to be resilient to attempts by unauthorised third parties to alter their use, outputs or performance. That last phrase is prompt injection described in legislative language. It is drafted as an outcome to be designed for rather than a control to be installed, because there is no control to install.

As of 24 September 2026.

Sign in to save your progress

You can read every lesson without an account. Signing in keeps your place and unlocks the assessment.