Prompt injection
An attack that hides instructions in text an AI model reads, such as an email or a web page, so the model follows the attacker instead of its user.
Prompt injection is an attack on AI systems built on language models. The attacker writes instructions into text the model will read, and the model follows them as if they came from its developer or user. It works because a model receives its instructions and the data it is working on in the same stream of text, and it has no reliable way to tell them apart. A translation tool asked to translate a sentence that says "ignore the above directions" may do exactly that.
The name borrows from SQL injection, a database attack discussed since the late 1990s, in which an attacker slips commands into a form field. Simon Willison popularised the term prompt injection in September 2022; it had appeared on Twitter a few months earlier, and in May 2022 the company Preamble had reported the weakness to OpenAI. In 2023 Kai Greshake and colleagues described indirect prompt injection, where the hostile instructions sit in a web page, document or email that the AI retrieves on its own rather than in anything the user typed.
The risk grows with what the AI is allowed to do. A chatbot that can only answer questions might be tricked into saying something embarrassing. An AI agent that can read your inbox, browse the web and send messages could be told, by a line of hidden text on a web page, to forward private files to an attacker. The OWASP Gen AI Security Project lists prompt injection first in its Top 10 risks for large language model applications.
There is no complete fix. OWASP says it is unclear whether fool-proof prevention exists, given how these models work. The defences that help are about design: give the AI the narrowest access it needs, keep sensitive functions in ordinary code rather than in the model's hands, mark outside content as untrusted, and require a person to approve risky actions such as payments or sending data. Treat any AI tool that reads outside content like a new employee who believes every note left on their desk.
Jailbreaking tries to make a model ignore its own safety rules, usually through clever prompts typed by a user. Prompt injection exploits the model's inability to tell instructions from data, so text from an untrusted source overrides what the developer or user intended. The two overlap, and OWASP treats jailbreaking as a form of prompt injection, but injection becomes the bigger business risk once AI tools can take actions. It is prompt injection where the attacker never talks to the AI directly. Instead, they plant instructions in content the AI will read later, such as a web page, a shared document, an email or a product review. When the AI retrieves that content to do a task, it may follow the hidden instructions. The text can even be invisible to people, as long as the model can read it. Limit what AI tools can access and do, following the principle of least privilege. Keep payments, data exports and messages to outsiders behind human approval. Treat anything an AI reads from email, the web or uploaded files as untrusted. Ask vendors how their products handle prompt injection, and test agents with deliberately hostile content before you connect them to real systems. Not with current techniques. OWASP's guidance says it is unclear whether fool-proof prevention exists, because models process instructions and data together as text. Filters and better training lower the success rate, but the dependable protection comes from design: limiting what a compromised AI could do, and keeping a human check on actions with real consequences.Common questions
What is the difference between prompt injection and jailbreaking?
What is indirect prompt injection?
How do I protect my business from prompt injection?
Can prompt injection be fully prevented?
Search for "OWASP LLM01 prompt injection", "indirect prompt injection" and "prompt injection mitigation" to understand the attack and the defences. The OWASP Gen AI Security Project, national cybersecurity agencies and peer-reviewed security research are the reliable sources, and AI providers' own security documentation explains the protections in their products. Treat any product that claims to block all prompt injection with care: the security community has not found a complete defence, so the claim overstates what the tool can do.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.