Explainer · Updated November 28, 2026 · 4 minute read
What is prompt injection?
The short answer
Prompt injection is an attack in which text written by an attacker gets treated as instructions by an AI system. The text is often hidden in content the system reads, such as a web page, an email or a document. The model may act on it, leaking private information or taking actions its user never asked for.
Why it works
A language model receives everything as one stream of text. The developer's instructions, the user's request and the contents of a web page all arrive in the same form, and the model has no reliable built-in way to tell which parts carry authority. If a page contains a sentence addressed to the AI, the model may follow it.
Direct and indirect injection
Security researchers usually separate two forms.
- Direct injection is typed by the person using the AI, for example a message telling a customer service bot to ignore its rules.
- Indirect injection is planted in content the AI will read later, such as hidden text on a web page or a line in an email.
Why agents raise the stakes
A chatbot that falls for an injection may say something wrong or embarrassing. An AI agent that can browse the web, read email and run code can do more damage, because injected text can direct those tools. A typical attack tells the agent to find private data and send it to an address the attacker controls.
The risk is highest when one system combines access to private data, exposure to content written by strangers and a way to send information out.
How it is defended against
No known method stops prompt injection completely, and AI developers describe it as an open problem. Defenses lower the odds and limit the damage. For everyday use, be careful about pointing an AI agent at untrusted websites or inboxes while it also has access to accounts that matter.
- Models are trained to treat content from tools and web pages as information and to distrust instructions inside it.
- Applications ask for human approval before actions that send or delete anything.
- Agents are given the least access they need, so a successful attack reaches less.
- Separate filters scan incoming content for text that looks like an attack.
Common questions
Is prompt injection the same as jailbreaking?
No, though the two overlap, and the OWASP security guidance for LLM applications treats jailbreaking as one form of injection. A jailbreak talks a model out of its developer's safety rules, and the person doing it is usually the user. Prompt injection makes an application follow text it was only meant to process, and the person harmed is usually that application's user or owner.
Am I at risk when using a normal chatbot?
The risk is low when a chatbot only answers from its own knowledge. It rises when the AI reads web pages or email, and again when it can act on your accounts.