Prompt injection (planting hidden instructions in text a model reads so it does something the owner did not intend) is the top risk for applications built on an LLM (large language model, the engine behind chatbots) in the OWASP Top 10 for LLM Applications (a list of risks for applications built on language models, published by OWASP, a nonprofit software security organization), in both the 2025 and 2026 editions, where it is entry LLM01. This article covers why it happens, how direct differs from indirect, the impact, and the layered measures an organisation can apply, along with the limits that have to be accepted.
Why a model cannot separate instructions from data
An LLM takes all of its text as one stream: the developer's instructions, the user's question and any content fetched, and then predicts the next word from that stream. There is no enforced line between instruction and data. OWASP states there is no equivalent of a parameterized query (a way to send commands to a database that keeps the command apart from the data), which is how SQL injection (attacking a database by inserting SQL commands into an input field) is fixed. The UK NCSC (the United Kingdom's National Cyber Security Centre) wrote on 8 December 2025 that prompt injection may never be mitigated as completely as SQL injection, and advised treating the model as an "inherently confusable deputy" and designing the system to limit damage rather than hoping to block everything.
Direct and indirect: who sends the instruction
- Direct: the user types the instruction to make the model ignore its rules, such as revealing the system prompt (the hidden text that sets the model's role). Jailbreaking (tricking a model into bypassing its safety rules) is a subset. OWASP notes it can also happen without the user meaning to
- Indirect: the instruction hides in external content the model reads on the user's behalf, such as a web page, email, document, the output of a tool the model calls, or text pulled in by RAG (a system that lets a model search company documents before answering). The user usually cannot see it, for example text in the background colour or invisible Unicode (the standard character-encoding set) characters
The indirect form was proposed in research as early as February 2023 (Greshake and colleagues, arXiv:2302.12173). The attacker needs no access to the target system, only to place text where the system will read it. OWASP adds that an attacker may plant text through a low-privilege channel in a place the system trusts, so the organisation's own agent (an AI program that plans and acts over several steps by itself) performs the high-privilege action. OWASP calls the indirect form the more dangerous one, especially for agents that browse the web or read files on their own. Our view: most organisations should weigh the indirect form first, because an employee can meet it without doing anything wrong. For a protocol-level example see What Is MCP?
Direct
- Sender: the usertypes the instruction into the chat box
- The user sees itit is in the conversation, easier to check and limit
Indirect
- Sender: whoever planted contenthidden in a web page, email, document or tool output
- The user usually cannot see itthe user unknowingly delivers the payload
Impact: from one line of text to a real action
The impact depends on what the model can reach. For a chatbot that only answers, damage usually stops at a wrong answer or data the model already saw leaking out. If the model is connected to email, files or internal systems, one hidden instruction can become a real action the user never notices. The sequence in the figure below is a general illustration we put together ourselves; each data-leak channel is drawn from OWASP's list of impacts.
- Data leaving the organisation: OWASP names channels such as an image link that carries conversation content in its URL, hidden Unicode text, and other side channels. The data at risk includes the system prompt, private documents and chat history
- Tools used without authorisation: a steered agent may send email or messages in the user's name, call APIs, or in serious cases run commands on connected systems. See the controls in Agentic AI Security
- Effects that persist across sessions: a hidden instruction written into an agent's memory or into a RAG document affects every query that reads from it. See RAG Security
Layered measures: design so being fooled does not become damage
- Least privilege: keep credentials and state-changing actions in application code, not in the model's hands, and run a fixed policy check at the moment of action. The OWASP Prompt Injection glossary calls reducing privilege generally the most effective measure
- Human approval for important actions: delete, transfer, send outside, and permission changes need a person who sees the actual action and its parameters, not the reasoning the model wrote to explain it
- Isolate untrusted content: a session that reads outside web pages or email should not also hold secrets or the right to send data out. OWASP calls this the Rule of Two: do not combine untrusted input, sensitive data, and a state change or outside communication, and if you must, approve each action
- Control the exits for data: stop showing external links and images in answers, and use an allowlist of destinations. See DLP (data loss prevention) as well
- Filter input and output, as a supporting layer: check output structure in code, strip invisible characters, and inspect answers for leaked data
- Monitor and test: log inputs, outputs and tool calls, then test with an attacker who knows what defences are in place. See AI red teaming
The limits of filtering need to be stated plainly. The OWASP cheat sheet says keyword lists miss rephrasing, other languages and encoded text, labelling data apart from instructions helps only against attacks that do not adapt, and a guardrail (a model that checks another model) is itself an LLM that can be injected. OWASP LLM01:2026 concludes that no reliable prevention mechanism exists today, so assume injection will sometimes succeed and limit what the model can reach and do. If the remaining risk is unacceptable, the NCSC notes that an LLM may not suit that use case (as of November 2026).
Where to start
- Take an inventory: list the AI apps and agents that read outside content (web, email, documents) and note which tools and data they are connected to
- Ask "if it is fooled, what can it do?": if the answer is send email or delete data, remove the permission or add approval before real use
- Separate reading outside content from holding secrets, at least into different sessions with different permissions
- Turn on tool-call logs and name who may cut the connection when behaviour looks wrong
- Test with a real hidden instruction in a test document or email and see whether the system obeys. Use the self-assessment to see the next priorities. This article is general information, not legal advice