AI security
What is prompt injection?
Prompt injection is an attack that tricks an AI system with hidden instructions, so the model follows an attacker's text instead of the rules its developer set. The instructions can be typed into a chat or hidden in content the AI reads, such as an email, a web page or a document. It works because a language model reads instructions and data as one stream of text.
By the KDS security engineering teamPublished 3 min read
Key takeaways
- Prompt injection is LLM01, the top risk in the 2026 OWASP Top 10 for LLM Applications.
- Direct attacks come from the user. Indirect attacks hide instructions in emails, web pages, documents or tool outputs.
- No filter stops it reliably, so limit what a fooled AI can reach and do.
On this page
What is prompt injection in technical terms?
An AI application sends the model one block of text: the developer's instructions, known as the system prompt, followed by the user's message and any data the AI works with. NIST defines prompt injection (opens in a new tab) as an attack that exploits this joining of untrusted input with a prompt written by a more trusted party, such as the developer. The UK National Cyber Security Centre (NCSC) explains that language models do not enforce a security boundary (opens in a new tab) between instructions and data inside a prompt.
An attacker uses this gap. If the text tells the model to ignore its earlier rules, reveal a customer's details or send a file to an outside address, the model may treat it as a new instruction. The OWASP Top 10 for LLM Applications 2026 (opens in a new tab) lists prompt injection as LLM01, its first risk.
Direct and indirect prompt injection
| Type | Who plants the instructions | Where they come from | Who is usually harmed |
|---|---|---|---|
| Direct | The user of the AI | A chat window, a web form or an API call | Your business, through leaked data or misused tools |
| Indirect | A third party who does not use your AI | Emails, web pages, uploaded files, knowledge base articles and tool outputs | Your legitimate user and your business |
NIST describes indirect prompt injection (opens in a new tab) as an attack carried out through control of a resource the AI reads, not through the user's own input. It matters most for AI agents that read email or browse the web, because anyone who can send you a message can put text in front of your AI. A jailbreak is a type of prompt injection that aims to make the model break its safety rules. Our post on prompt injection examples walks through 10 attack patterns we test for.
Why it matters for your business
A chatbot that falls for prompt injection may give a wrong answer or reveal its instructions. An agent with tools can do more damage: forward private emails, change a record or issue a refund on an attacker's instruction. NIST and the NCSC both warn that current defenses do not offer full protection, so the realistic aim is to keep a successful attack small.
How to reduce the risk: give each agent only the tools and data its task needs, and require a person's approval for payments, data exports, deletions and messages to outside recipients. Mark content from emails, web pages and uploads as untrusted, and keep agents that read it away from tools that move money or send data out. Check every tool call and reply in application code before it takes effect, and block links and images to unknown domains. Log inputs, outputs and tool calls, and attack-test the agent before launch and after each change. Our prompt injection guide explains each layer, and our AI security consulting team tests agents against them.
Related terms
- AI agent: software that plans and carries out tasks with tools connected to other systems.
- Jailbreak: a prompt injection that aims to make a model ignore its safety rules.
- AI guardrails: controls around a model that check and limit its inputs, outputs and actions.
Sources
- 1.Prompt injection (glossary entry, from NIST AI 100-2 E2025), NIST Computer Security Resource Center (opens in a new tab)
- 2.Indirect prompt injection (glossary entry, from NIST AI 100-2 E2025), NIST Computer Security Resource Center (opens in a new tab)
- 3.NIST AI 100-2 E2025, Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations, NIST, 2025-03-24 (opens in a new tab)
- 4.Prompt injection is not SQL injection (it may be worse), UK National Cyber Security Centre, 2025-12-08 (opens in a new tab)
- 5.OWASP Top 10 for LLM Applications 2026, OWASP GenAI Security Project, 2026-08-03 (opens in a new tab)
