Definition · AI security
Prompt injection
Prompt injection is an attack on language models in which instructions are hidden inside text the model reads, causing it to follow the attacker rather than the operator. It works because a model receives instructions and data through the same channel and has no reliable way to tell them apart.
Last reviewed
Key points
- Prompt injection is the first entry on OWASP's Top 10 for LLM applications, and has been in every edition of that list.
- It works because a language model cannot tell instructions from data. OWASP says both are tokens on the same stream, so there is no clean equivalent to a parameterized query.
- Better prompting does not fix it. An instruction telling the model to ignore injected instructions is text in the same channel as the attack, and can be overridden the same way.
- Detection is a signal, not a fix. Twelve recent defences were re-tested against attackers who had read them, and most fell with attack success above 90 percent despite originally reporting near zero.
- The dangerous form is indirect: the instruction sits in a page, a document or a tool result the model retrieves, so the attacker never has to breach the application and the user never sees the instruction. The defences that hold limit what a bypassed model can do rather than stop it being fooled.
Prompt injection hides instructions inside text a language model reads. Whoever controls that text can give the model orders, because the model cannot tell it apart from the operator’s own instructions. Simon Willison named the attack in September 2022.
Direct injection is a user typing instructions that contradict the system prompt. Indirect prompt injection is the dangerous case: the instruction sits in content the model retrieves, so the attacker never has to breach the application and the user never sees the instruction.
Why prompt injection has no clean fix
Prompt injection has no clean fix because the boundary it violates was never there. OWASP states that models make “no architectural distinction between ‘instructions’ and ‘data’”, both being “tokens on the same stream”, so “there is no clean equivalent to parameterized queries.” Nothing in that stream carries a mark the model must respect.
Better prompting therefore cannot close it: an instruction to ignore injected instructions is text in the same channel as the attack. Nor can detection — twelve recent defences, re-tested against attackers who had read them, mostly fell with attack success above 90 percent.
The NCSC frames a language model as a confused deputy that is inherently confusable, so the risk can be reduced and not removed. OWASP agrees: no reliable prevention mechanism exists, so defence is “architectural rather than interceptive”, with least privilege “load-bearing” for agents. What holds is prompt injection mitigations, and for an agent, the lethal trifecta.
Where definitions disagree
Whether jailbreaking is prompt injection is disputed. OWASP says it is, in the 2026 edition and the 2025 one before it: jailbreaking is “the subset of prompt injection where the attacker’s goal is to make the model violate its safety protocols.” Willison, who coined the term, says it is not: with no concatenation of a trusted developer prompt and untrusted input, it is not prompt injection.
This page follows the narrow reading, because the parties and the defences differ. Jailbreaking is the operator pushing on the model’s own safety training; injection is a third party pushing on someone else’s application. Willison’s example of the cost: a detector trained on jailbreaks blocks a request for a napalm recipe and allows an instruction to search a mailbox and forward the results to an attacker.
Questions and answers
Is prompt injection the same as jailbreaking?
Authorities disagree. OWASP's LLM Top 10 treats jailbreaking as the subset of prompt injection where the attacker's goal is to make the model violate its safety protocols. Simon Willison, who coined the term, keeps the two apart, and this page follows him: jailbreaking attacks the safety training inside the model, usually driven by the person operating it, while prompt injection attacks an application that concatenates a trusted prompt with untrusted text, and the attacker is usually someone other than the operator.
Can prompt injection be fixed by better prompting?
No. Instructing a model to ignore injected instructions is itself text in the same channel the attack uses, so it can be overridden the same way. OWASP classes constraining the model in the system prompt as a partial control only, to be paired with privilege controls held in application code. The defences that hold limit what the model is able to do rather than stop the model being fooled.
Is prompt injection the same as SQL injection?
Prompt injection and SQL injection share a shape and not a cure. Simon Willison named prompt injection after SQL injection because both concatenate untrusted input with trusted instructions. The UK's National Cyber Security Centre argues the comparison becomes dangerous past that point: parameterised queries fix SQL injection at its root because a database engine enforces the line between instruction and data, and a language model enforces no such line, so the mitigation has no equivalent.
Sources
- Prompt injection attacks against GPT-3Simon Willison, 12 Sep 2022
- LLM01:2026 Prompt InjectionOWASP GenAI Security Project
- LLM01:2025 Prompt InjectionOWASP GenAI Security Project
- OWASP Top 10 for LLMs and Gen AI Apps 2023-24OWASP GenAI Security Project
- Prompt injection and jailbreaking are not the same thingSimon Willison, 5 Mar 2024
- Prompt injection is not SQL injection (it may be worse)UK National Cyber Security Centre, 8 Dec 2025
- The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against LLM Jailbreaks and Prompt InjectionsarXiv, 10 Oct 2025
Guides that use this term
Related topics
In the news
- In tests, 62 of 72 AI agent incidents with damage had no attacker
- AutoPI finds more methods to break AI agents than other test tools
- Microsoft releases Cowork browsing, but agent identity is in preview
- AWS repairs an MCP server bug that could leak a database token
- BELLS-O tests 33 AI safety filters for speed and cost
- Two Granite 4.1 preview models use tags against prompt injection
- AI agents make new attacks that get 100% on a strong model
- A monitor external to the model cut AI agent attack success to 1.3%
- A thought that copies a model style gets control of AI agents
- Prompt injection guards give incorrect alarms on 92% of some contracts
- Test shows that defenses miss attacks on the decisions of AI agents
- Researchers bypassed ChatGPT Lockdown Mode through HTML preview
- One incorrect risk review controls AI agents in 60.4% of tests
- Study names 9 types of prompt injection attack
- Docker repairs a bug that let AI agents read secret files
- CrowdStrike agrees to buy 2 AI startups and adds a kill switch
- Tests show 4 of 4 AI providers open to attack in code pipelines
- CrowdStrike will buy Dreadnode to test AI agents before launch
- Wandhöfer tells that AI agents break payment authentication
- A new training method cuts prompt injection success to 8.8%
- AgentShield finds AI browser agents by how they use web forms
- Agents that change from feedback obey attackers more frequently
- One short suffix flips 43% of unseen documents for the Jev model
- CrowdStrike list of prompt injection attacks has 222 methods
- Terra has less high-severity flags but more small flags in OpenAI tests
- Attacks change 46.3% of correct answers by the Jev decision model
- A broken part in an AI gateway left its system score almost the same
- Attacks that keep answers almost correct have more success on 7 models
- A prompt injection detector does not work in agent tests
- CarryoverBench shows that a planted attack fires again in 5 rounds
- Three US agencies release ten practices for AI agent incidents
- One prompt injection makes an AI agent send 51 times more calls
- Fake news has 62% success against trading agents, injection only 14%
- Thinking cuts injection risk in Qwen3 but makes it larger in 2 models
- AICPA and AIUC start a joint certification for AI agents
- A cache attack on AI reasoning reaches 79% success in tests
- INFUSE tests 19 language models on 56 prompt injection attacks
- MIRAGE puts image attacks in ad slots to control web agents
- Prompt-injection gates sent more than 91.8% of inputs to a reviewer
- HiddenLayer says the Jev model is open to attacks that LLMs stop
- OWASP moves excessive agency from sixth to third in 2026
- A delayed attack can make some AI agents stop life-support systems
- A new test set has 38,675 page pairs for prompt injection
- The CLIOPATRA attack gets private medical data from Clio
- Participants in a public challenge wrote 208,095 attack prompts
- Researchers made prompt injection attacks work, with a maximum rate of 96%