Skip to content

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

Direct and indirect prompt injection compared
TypeWho plants the instructionsWhere they come fromWho is usually harmed
DirectThe user of the AIA chat window, a web form or an API callYour business, through leaked data or misused tools
IndirectA third party who does not use your AIEmails, web pages, uploaded files, knowledge base articles and tool outputsYour legitimate user and your business
Direct and indirect prompt injection compared

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.

  • 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. 1.Prompt injection (glossary entry, from NIST AI 100-2 E2025), NIST Computer Security Resource Center (opens in a new tab)
  2. 2.Indirect prompt injection (glossary entry, from NIST AI 100-2 E2025), NIST Computer Security Resource Center (opens in a new tab)
  3. 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. 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. 5.OWASP Top 10 for LLM Applications 2026, OWASP GenAI Security Project, 2026-08-03 (opens in a new tab)

Get a free 30-minute assessment

Walk us through the AI tools and agents you use or plan to launch. We'll point out the biggest risks and the first fixes, in plain words.

Frequently asked questions

What is prompt injection in simple terms?

Prompt injection is a way to trick an AI with hidden instructions. The attacker writes text that the AI follows as if it were a command from its owner. The text can be typed into a chat or hidden in something the AI reads, such as an email or a web page. The goal is often to make the AI reveal data or take an action it should not.

What is an example of prompt injection?

A web page contains text that people cannot see on screen. It tells any AI that summarizes the page to recommend a certain website or to add the reader's details to a link. When an assistant summarizes that page for a user, it may follow the hidden text. The user did not type the instruction, which makes this an indirect attack.

Can prompt injection be prevented?

Not completely with current technology. NIST states that current mitigations do not offer full protection against all attacker techniques, and the UK NCSC warns that prompt injection may never be fully mitigated. You can make attacks harder and limit their effect with least-privilege access, approval for high-impact actions, output checks, monitoring and regular attack testing.

What is the difference between prompt injection and a jailbreak?

A jailbreak is one type of prompt injection. Its goal is to make the model break its safety rules, for example to produce content it would normally refuse. Prompt injection is the wider class of attack. It can target any behavior, including which data the AI reveals, which tools it calls and where it sends information.

Services and use cases

  • Customer support lead calmly reviewing a short list of escalated tickets at her desk

    Use case

    AI customer support

    AI customer support agents that resolve order, return and account questions from start to finish and hand complex cases to your team with full history.

    See how the AI support agent works
  • Service

    AI security and red teaming

    AI security consulting for AI agents and LLM apps: red teaming, prompt injection testing, shadow AI discovery and EU AI Act and ISO/IEC 42001 readiness.

    Explore AI security consulting

Free 30-minute assessment

Find the one workflow worth automating first.

Tell us how your team works. We'll come back with two or three AI opportunities, the risks to watch and a rough payback estimate. No obligation.

  • A senior engineer replies within one business day
  • We can sign an NDA before you share details
  • No fixed packages, every quote tailored to you
What can we help with?
About your company

Company size

When would you like to start?

How can we reach you?

Encrypted in transit · read only by our team · never sold

Free 30-minute AI assessmentGet it →

Before you go

Find out where AI can save your team time

Book a free 30-minute assessment. A senior engineer reviews one workflow with you and sends back the opportunities, the risks and a rough payback estimate.