On this page
Imagine hiring an extremely capable assistant who reads everything you give them, follows instructions very well, and cannot reliably tell the difference between your instructions and instructions written inside the documents you ask them to read. Now imagine giving that assistant access to your email, your calendar and your files.
That is, roughly, the problem called prompt injection. It is the single most discussed security weakness of applications built on large language models, the technology behind modern chatbots and AI assistants. This guide explains what it is in plain English, how the attacks work, why experts say it cannot simply be patched, and what organisations can do to limit the damage. It follows on from our overview of agentic AI security.
What prompt injection is
A large language model, or LLM, takes text in and produces text out. Applications wrap it with instructions, such as “You are a helpful support assistant. Never reveal customer data.” They then add the user’s question and sometimes extra material, such as a document or search results.
To the model, all of that is just text. There is no hard wall between “instructions from the developer” and “data to be processed”. Prompt injection exploits that. OWASP’s GenAI Security Project describes it as inputs that alter an LLM’s behaviour or output in unintended ways, and notes that the inputs do not even need to be visible to humans as long as the model can read them.
It has been first on OWASP’s list of top risks for LLM applications since the list was created, and the 2025 edition keeps it as LLM01.
Two main kinds
Direct prompt injection
The user types something that changes the model’s behaviour. Classic examples are “ignore your previous instructions” or elaborate role-play designed to get the model to do what it was told not to. It can be deliberate or accidental. OWASP notes that jailbreaking, where someone tries to get the model to abandon its safety rules entirely, is a form of this.
Direct attacks mostly threaten the application’s own rules, for instance extracting a hidden system prompt or producing disallowed content. They matter, but the person attacking is the person using the tool.
Indirect prompt injection
This is the more serious category for businesses. The model ingests external content, such as a web page, email, PDF, spreadsheet, support ticket or code repository, and that content contains instructions. The user did nothing wrong. The attacker never interacted with the model at all.
Consider three hypothetical scenarios:
- The poisoned web page. An AI browsing assistant is asked to summarise a page. Hidden text on the page tells it to collect the user’s recent emails and send them to an address controlled by the attacker.
- The booby-trapped email. An AI mail assistant that drafts replies reads a message that says, in white-on-white text, to forward the last ten invoices to an external address.
- The tampered document. A hiring tool that ranks CVs reads a resume with hidden text telling it to score the candidate as the best match.
These are illustrations, not reports of specific incidents, but they follow the pattern OWASP and the UK National Cyber Security Centre describe: the model treats instructions inside untrusted content as if they were legitimate.
Why it matters more as AI gets more capable
A chatbot that only answers questions can do limited harm if it is tricked. The risk rises with agency, meaning the ability to act. OWASP lists the potential impacts as disclosure of sensitive information, exposure of system details, manipulated content, unauthorised access to functions available to the model, execution of commands in connected systems, and manipulation of critical decisions.
Every tool you connect to an AI assistant multiplies both its usefulness and its attack surface. An assistant that can send email, edit files, call APIs or move money is a much more attractive target than one that can only talk. This is why the move toward AI “agents” that act on a user’s behalf makes the topic urgent for security teams.
Why it cannot simply be patched
Older web vulnerabilities such as SQL injection were eventually tamed by a structural fix: parameterised queries, which keep code and data separate so that user input can never be mistaken for commands.
In late 2025 the UK’s NCSC published a widely discussed post arguing that prompt injection is not like SQL injection, and that treating it as such is dangerous. Its reasoning is that LLMs have no built-in boundary between instructions and data. Underneath, the model is predicting the next piece of text from everything in front of it. The NCSC describes the model as an “inherently confusable deputy” and concludes that prompt injection may never be fully mitigated in the way SQL injection was. The task, in its words, is to reduce the likelihood and the impact, not to expect a clean fix.
OWASP reaches a similar conclusion in practical terms: it says that, given how these models work, no fool-proof way of preventing prompt injection is known, and recommends layered measures.
That is a sobering message, but it is also useful. It tells you where to invest: in design, not just filters.
Practical defences
None of these is a silver bullet. Together, they reduce the chance of a successful attack and shrink the damage if one occurs.
1. Give the AI the least privilege it needs
Do not give an assistant access to everything because it is convenient. OWASP recommends handling privileged functions in application code rather than letting the model call them directly. The NCSC advises limiting privileges so that a model processing content from an untrusted party does not also have access to privileged tools.
2. Require human approval for high-risk actions
Sending money, deleting data, sharing files externally or changing permissions should need a person to review and confirm. It slows things down in exactly the places where speed is dangerous.
3. Separate and label untrusted content
Make it clear to the model and to your own code which text comes from the developer and which comes from outside. The NCSC suggests separating data from instructions, for example by wrapping external content in tags. That makes attacks harder, but it does not make them impossible, so treat it as one layer among several.
4. Validate outputs with ordinary code
If you expect the model to return a date, a category or a JSON object, check that it does, with deterministic code. Reject anything outside the expected format rather than passing it to another system.
5. Filter and monitor, but do not depend on filters
Input and output filtering, including semantic checks, can catch some attacks. The NCSC warns against relying on deny-lists of “bad phrases”, because attackers can rephrase easily. Logging inputs, outputs and tool or API calls lets you detect and investigate suspicious behaviour.
6. Test adversarially
OWASP recommends regular adversarial testing, treating the model as an untrusted user. That means trying to break your own system, in a controlled way, before someone else does.
7. Plan for failure
Assume that sometimes the model will be fooled. Ask what the worst realistic outcome is and whether your controls would contain it. Keep sensitive data out of the model’s reach where possible.
A quick risk checklist for business owners
- Do we know where we use AI assistants or agents, including those staff signed up for themselves?
- What data can each one read? What actions can each one take?
- Does any assistant read untrusted content, such as inbound email, web pages or uploads, and also hold access to sensitive tools?
- Which actions need human approval?
- Are inputs, outputs and tool calls logged and reviewed?
- Do our suppliers explain how they handle prompt injection in their AI features?
- Does our staff training mention AI-related risks, including the ways attackers use AI in phishing?
How this connects to the rest of your risk programme
Prompt injection is a new name for an old problem: untrusted input being treated as trusted instruction. Many established disciplines still apply.
- Vendor management. If a supplier embeds AI in a product that touches your data, ask about its safeguards as part of your vendor risk management.
- Detection and response. Monitoring tools and a response plan matter as much for AI-related incidents as for traditional ones. Our comparison of EDR, MDR, XDR and SIEM explains the options.
- Financial controls. If an AI assistant can prepare or approve payments, the same call-back and dual-approval controls that stop business email compromise should apply.
- Insurance. Policies and application forms are only starting to address AI-specific risks. If you rely on AI tools, ask your broker how an AI-related incident would be treated. Our guide to cyber insurance application questions shows the kinds of controls insurers ask about.
What to expect next
Standards bodies are working on the problem. The US National Institute of Standards and Technology publishes a taxonomy of adversarial machine learning attacks, including those that target generative AI systems, to give researchers and practitioners a shared vocabulary. Expect more guidance and more tooling over time, but also expect the core advice to stay stable: assume models can be manipulated, and design the system so that manipulation cannot cause serious harm.
The bottom line
Prompt injection is not a bug awaiting a patch. It is a property of how language models process text. The organisations that handle it well are those that treat AI components as powerful but gullible, give them narrow permissions, keep humans in the loop for consequential actions, and watch what they do. Used that way, AI assistants can be both useful and reasonably safe.
This article is for general awareness and is not security, legal or compliance advice. The field is changing quickly, so check the cited sources for current guidance and consult a qualified professional before deploying AI systems that handle sensitive data.
Frequently asked questions
What is prompt injection?
Prompt injection is an attack in which crafted input causes a large language model to behave in ways its developers or users did not intend, for example ignoring its instructions, revealing information or taking an unwanted action. The input can be typed by a user or hidden in content the model processes.
What is the difference between direct and indirect prompt injection?
In direct prompt injection, the user's own prompt changes the model's behaviour. In indirect prompt injection, the model reads external content, such as a web page, email or file, that contains hidden instructions which alter what it does.
Is prompt injection the same as jailbreaking?
They are related. OWASP describes jailbreaking as a form of prompt injection that aims to make the model abandon its safety rules altogether. Prompt injection is the broader category and can also aim at data theft or misuse of connected tools.
Can prompt injection be fully prevented?
Current guidance says no fool-proof prevention is known. OWASP recommends layered controls, and the UK NCSC advises treating it as a residual risk to be managed through secure design rather than expecting a single fix.
How can a business reduce prompt injection risk?
Limit the permissions and data the AI can reach, require human approval for high-impact actions, treat all external content as untrusted, validate outputs with ordinary code, log activity and test regularly with adversarial inputs.