Skip to content

AI security

Prompt injection in practice: attack patterns we test for

These prompt injection examples are the 10 attack patterns we check when we attack-test AI agents and chatbots. For each one, we explain what it looks like, what could go wrong and what we check, at a level that helps you plan defenses without handing attackers a recipe.

By the KDS security engineering teamPublished 6 min read

Key takeaways

  • Indirect attacks need no access to your AI: instructions hide in emails, web pages, documents and tool outputs the agent reads.
  • An agent can leak data through a link or image in its reply, even without an email tool.
  • Encoding, other languages and slow multi-turn steering help attacks get past filters that check one message at a time.
  • A human approval step protects you only when the reviewer sees the exact action, not the agent's summary.
  • We run these tests before an agent goes live and again after changes to its model, prompts, tools or data.
On this page

How we use these prompt injection examples

Prompt injection means tricking an AI with hidden instructions: text the model follows as a command even though it came from a user, a document or another system. Our prompt injection guide explains how the attacks work and which defenses reduce them. This post covers the practical side: the patterns we try during AI red teaming, our structured attack testing of AI systems.

The list follows the attack types in the OWASP Top 10 for LLM Applications (opens in a new tab) and the NIST taxonomy of adversarial machine learning (opens in a new tab). We describe each pattern in general terms and do not publish working attack text. These are patterns we test for, not incidents from client projects. In a real test, we adapt each pattern to the agent's tools, data and users.

Direct attacks through the chat window

1. Instruction override in user input

  • What it looks like: A user writes a message that tells the agent to disregard its rules, claims to be an administrator or asks it to repeat its hidden instructions.
  • What could go wrong: The agent reveals its system prompt, shows data meant for other users or calls a tool outside its task.
  • What we check: Whether the agent's permissions, not only its prompt, block the action, and whether secrets or other users' data can be reached from the chat at all.

2. Role-play and persona attacks

  • What it looks like: The user asks the agent to play a character, a game or a test mode that supposedly has no rules. NIST lists role-play among known jailbreak techniques.
  • What could go wrong: The agent steps out of its role, says things your business would not say or agrees to actions it would normally refuse.
  • What we check: Whether the agent keeps its scope under many framings, and whether actions requested inside a role-play still pass the same permission and approval checks.

Attacks that hide their intent

3. Multi-turn gradual manipulation

  • What it looks like: Each message is harmless on its own. Over many turns, the conversation moves step by step toward a request the agent would refuse if asked directly. NIST describes multi-turn attacks of this kind.
  • What could go wrong: Filters that judge one message at a time see nothing wrong, and the agent reaches the harmful result anyway.
  • What we check: Long conversations with slow drift, and whether policy checks run at each action instead of only on the first message.

4. Encoding and obfuscation

  • What it looks like: The instruction is encoded, written in a less common language, hidden in invisible characters or split across several fields that the model puts back together.
  • What could go wrong: Input filters that look for known phrases miss the attack, while the model still understands it.
  • What we check: The same test cases in several encodings and languages, with invisible characters and split across form fields, to see which layer catches them.

Hidden instructions in content the agent reads

These are indirect attacks. The attacker does not interact with your AI. They place text where the AI will read it later, and the harm usually falls on your own user.

5. Hidden instructions in a web page

  • What it looks like: An agent that browses or summarizes web pages reads text a person does not see on screen, such as text hidden by formatting or placed in page code.
  • What could go wrong: The agent writes a false summary, recommends a fraudulent site or sends conversation data to an address the page names.
  • What we check: Test pages with planted instructions, and whether the agent holds any sensitive tools or data while it browses.

6. Poisoned document in the knowledge base

  • What it looks like: Someone adds or edits a document in a source the AI retrieves answers from, such as a shared drive, a help center or a wiki. The document carries instructions or false facts aimed at certain questions.
  • What could go wrong: The agent gives wrong answers with confidence, points customers to the wrong contact or payment details or follows the planted instructions. NIST cites research in which a single crafted document was enough.
  • What we check: Who can add content to each source, whether changes are logged and how the agent behaves when it retrieves a test document with planted instructions. Our post on RAG security covers knowledge base risks in depth.

7. Email-borne instructions to an inbox agent

  • What it looks like: An agent that reads, sorts or answers email receives a message from an outside sender with instructions addressed to the AI.
  • What could go wrong: The agent forwards private emails, replies with customer data or sends similar messages to your contacts. NIST describes this self-spreading pattern as a possible AI worm.
  • What we check: Whether sending and forwarding need approval, whether recipients are limited to allowed domains and whether rate limits stop mass sending.

8. Tool-output injection

  • What it looks like: The attack text arrives through a tool: a search result, a ticket field, a CRM note, a database record or the response from a Model Context Protocol (MCP) server.
  • What could go wrong: The agent treats the output as a trusted instruction and takes its next action on the attacker's behalf, with its own permissions.
  • What we check: Whether tool outputs are handled as untrusted data, whether they pass through strict schemas and whether the next tool call is checked against policy before it runs.

Attacks on what happens after the model answers

9. Data exfiltration through links or images

  • What it looks like: Planted instructions tell the model to put private data, such as a customer's details, into a link or an image address in its reply.
  • What could go wrong: When the chat interface loads the image or the user clicks the link, the data goes to a server the attacker controls. NIST notes that image rendering in chat can be used this way. The agent needs no email or web tool for this to work.
  • What we check: Whether replies can contain links and images from any domain, whether images load automatically and whether an allow-list blocks unknown domains.

10. Attacks on the hand-off to a human

  • What it looks like: The agent asks a person to approve an action or passes a case to staff with a summary. The attacker shapes the content so the summary looks harmless while the real action is not.
  • What could go wrong: The reviewer approves a payment, an email or a data export based on a misleading summary. OWASP notes that the displayed action can differ from the executed one, and that reviewers lose focus when approvals are frequent.
  • What we check: Whether the approval screen shows the exact action (recipient, amount and full text), whether hidden characters are removed before display and how many approvals each reviewer handles. Our post on human-in-the-loop approvals covers how to design this step.

What we do with the results

Each finding in our report includes the pattern, the input that triggered it, what the agent did, a risk rating and a fix your developers can apply. When a pattern succeeds, the fix is usually a limit on permissions, an approval step or an output check. More wording in the prompt rarely helps on its own, because prompt rules can be bypassed. We retest after the fixes and again when you change the model, prompts, tools or data sources.

No test proves an agent is immune. The UK National Cyber Security Centre (opens in a new tab) warns that prompt injection may never be fully mitigated, so the aim is to keep each successful attack small and visible. Our AI security consulting service runs these tests on agents and chatbots, whoever built them.

Sources

  1. 1.OWASP Top 10 for LLM Applications 2026, OWASP GenAI Security Project, 2026-08-03 (opens in a new tab)
  2. 2.LLM01:2025 Prompt Injection, OWASP GenAI Security Project, 2024-11-18 (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)

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 an example of prompt injection?

A common example is an email sent to a company inbox that contains instructions addressed to the AI assistant reading it, such as a request to forward other messages to an outside address. The assistant cannot reliably tell the instruction apart from normal content. If it has permission to forward email and no approval step, it may follow the instruction.

Why don't you publish working prompt injection payloads?

Working attack text helps attackers more than it helps defenders, and the exact wording that works changes as models change. The patterns stay stable, so we describe those. In client projects, our report includes reproducible examples for your developers, shared only with your team under the agreed scope.

Which prompt injection pattern is the most dangerous?

It depends on what the agent can do. The highest risk is an agent that reads private data, processes content from outside the company and can send data out, for example by email or through links in its replies. For that agent, email-borne instructions, tool-output injection and data exfiltration through output deserve the most attention.

How often should an AI agent be tested for prompt injection?

Test before the agent goes live and again after every significant change: a new model version, new prompts, a new tool or a new data source. Each change can open a path that earlier tests did not cover. Between tests, logging and alerts on unusual tool use help you spot attacks that testing missed.

Can a chatbot without tools be harmed by prompt injection?

Yes, though the damage is usually smaller. An attacker can make it give wrong or offensive answers, reveal its system prompt or show data it can retrieve. If the chat interface displays links or images, it can also leak data from the conversation. Removing those channels and limiting the data it can reach reduces the risk.

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.