What is Prompt Injection?
Types, Examples and Prevention

Prompt injection is an attack where someone hides instructions inside text that an AI tool reads, such as a chat message, email or file. A prompt is the instruction given to an AI. The AI then ignores its real rules and follows the attacker, which can leak data or trigger wrong actions.

Short Answer Prompt injection is an attack where someone hides instructions in text that an AI tool reads. The AI then ignores its real rules and follows the attacker instead. For example, a hidden line in an email can tell an AI assistant to send private data outside. A prompt is simply the instruction you give an AI tool.

What is Prompt Injection?

Most AI tools at work run on a large language model. This is a program trained on huge amounts of text, so it can read and write like a person. The company gives the tool its rules, for example “answer only questions about our products” or “never share customer details”. Then users and documents add more text on top.

Prompt injection happens when some of that extra text carries new instructions. The AI reads everything as one long message. So it can mistake the attacker’s words for real orders and obey them. As a result, the tool may leak data, give a wrong answer or take an action nobody approved.

The name comes from an older attack. In SQL injection, an attacker slips commands into a web form. Here, the attacker slips instructions into a prompt instead. People who write good prompts on purpose practice prompt engineering; prompt injection is the misuse of the same idea.

Key Words to Know

  • Prompt: the instruction or question you give an AI tool.
  • System prompt: the hidden rules the company gives the AI before any user types.
  • AI agent: an AI tool that can take actions, such as sending email or updating records.
  • Guardrail: a safety check that screens what goes into and comes out of an AI tool.
  • Untrusted content: any text the company did not write itself, such as a web page, an email, an uploaded file or a user’s message.

How a Prompt Injection Attack Works

A prompt injection attack uses a simple weakness. Today, AI models cannot always tell the difference between rules and data. In fact, OWASP, a nonprofit security community, says these models treat instructions and data as the same kind of text. So the attack usually follows four plain steps.

  1. The company sets rules: it tells the AI tool what it may and may not do.
  2. New text arrives: a user types a message, or the tool reads an email, file or web page.
  3. The text hides an order: somewhere inside, a line tells the AI to ignore its earlier rules and do something else.
  4. The AI follows it: because it cannot always spot the trick, it obeys the new line instead of the company’s rules.

This risk grows as generative AI tools do more work for us. A tool that only writes text can give a bad answer. However, a tool that can send mail, open files or make payments can do real harm.

Types of Prompt Injection

Security teams sort prompt injection into two main types. The difference is where the hidden order comes from.

Type Where the Order Hides Plain Example
Direct Typed straight into the chat box by the user A user tells a support bot to forget its rules
Indirect Inside content the AI reads, such as a web page, email, PDF or resume An email holds a hidden line the user never sees

Indirect attacks are harder to spot, because the person using the tool never typed anything wrong. They often reach the AI through retrieval augmented generation, where the tool pulls in company documents or web pages to answer a question. If one of those documents carries a hidden order, the AI may read it and act on it.

Hidden Text in a Resume

A CV is a common place to hide such text. Some job seekers hide white text on a white page in their CV. A person reading the CV sees nothing. However, an AI screening tool reads the hidden line, which may tell it to rank the CV first. This is indirect injection, and it shows why companies should never let an AI tool make hiring choices alone.

Prompt Injection Examples

These short prompt injection examples show the idea without any real attack text:

  • Support chatbot: a user tricks a shop’s chatbot into showing another customer’s order details.
  • Email assistant: a hidden line in a vendor email asks an AI helper to forward invoices to an outside address.
  • Resume screener: a CV with hidden text pushes itself to the top of the list.
  • Browsing agent: a web page tells agentic AI, an AI that plans and acts on its own, to share a user’s data.
An AI email helper reads a vendor email with hidden text, and a tool rule blocks sending data outside the company.
A tool rule that allows drafts only stopped the hidden order in the Bhopal insurance company’s vendor email.

An Example From a Bhopal Insurance Company

For example, an insurance company in Bhopal uses an AI email helper. It reads incoming mail, writes short summaries and drafts replies for the claims team. One morning, a vendor email arrives with a line in tiny, white text. The line tells the AI to collect payment details and send them to an outside address.

The AI reads the line, and it even tries to act on it. But the IT team had set a tool rule: the helper may only draft replies, never send mail outside the company. So the action fails. Next, the system logs the blocked attempt and alerts the security team. They check the email, block the sender and report the case to the vendor. In short, the AI was fooled, but the tool rule still stopped the damage.

Prompt Injection vs Jailbreak

People often mix up these two words, and they do overlap. A jailbreak tries to make the AI break its own safety rules, for example to write harmful content it should refuse. Prompt injection is wider. It slips in orders from outside, often through the data the AI reads, to take over what the tool does for a company.

Question Prompt Injection Jailbreak
Main goal Make the tool follow the attacker instead of the company Make the model break its built-in safety rules
Who sends it A user, or hidden text in a file, email or web page Usually the user typing in the chat box
Typical harm Data leaks and wrong actions Harmful or banned content

So the two overlap: a jailbreak typed into the chat box is one kind of direct prompt injection. Many safety tools, including the ones below, check for both at the same time.

Talk to an ExpertCould a hidden line in an email misuse your AI tools? Talk to our team about prompt injection.

Why It is a Business Risk

Companies now connect AI tools to email, files, customer records and business apps. Because of this, one hidden line can reach much further than a single chat window. The main risks are these:

  • Data leaks: the AI may reveal customer details, business plans or its own hidden rules.
  • Wrong actions: an AI agent may send mail, change records or approve steps nobody asked for.
  • Wrong answers: customers may get false or harmful replies in the company’s name.
  • Loss of trust: staff and customers stop trusting the tool after one bad event.

Prompt injection is one part of the wider field of AI security. It also links to data loss prevention, because a tricked AI tool can become a new way for data to leave the company.

Where It Ranks in the OWASP List

OWASP publishes a Top 10 list of the main risks for apps built on large language models. Prompt injection sits first on that list in both the 2025 and the 2026 editions. OWASP gives it the code LLM01, which simply means risk number one. That ranking tells security teams to deal with it before most other AI risks.

Ways to Prevent Prompt Injection

No single fix stops prompt injection today. Even OWASP says no reliable way exists yet to prevent it fully. So companies build several layers, and each layer catches what the last one missed.

  1. Treat outside text as data: keep company rules separate, and label emails, files and web pages as untrusted.
  2. Give the least access: let each AI tool reach only the data and actions it truly needs.
  3. Ask a person to approve: require a human to confirm risky steps, such as sending money or mail outside.
  4. Filter inputs and outputs: screen what goes in and what comes out for attack patterns and private data.
  5. Test before launch: try safe attack tests on the tool before staff and customers use it.
  6. Log and watch: record what the AI does, and alert the security team about odd actions.

Clear rules on who may use which AI tool also help. That work belongs to AI governance, which sets the policies these controls follow.

Six stacked layers, from an input filter to least access, human approval, output filter and alerts, guard an AI tool.
Each layer catches what the one before it missed, because no single control stops every hidden order.

Filters on AWS and Azure

AWS and Microsoft both offer filters that look for these attacks:

  • Amazon Bedrock Guardrails prompt attack filter: it checks user input for jailbreaks and prompt injection. On the Standard tier, it also catches attempts to reveal the hidden system prompt. When you call the model directly with InvokeModel, you must mark which part of the input comes from the user. Without that mark, the filter does not check that input for these attacks. Note that this filter does not check tool results, which is the text that comes back when the AI uses another tool, such as a web search.
  • Azure AI Content Safety Prompt Shields: it looks for two kinds of attack. User prompt attacks come through the chat box, while document attacks hide in emails, files or web pages. In Microsoft Foundry, the user prompt check is on by default, but you must turn on the document check yourself.

Why It Cannot Be Fully Removed

Attackers can reword their orders in endless ways, so filters will miss some. Therefore, the safest plan assumes an attack will one day get through. Limits on access and human approval then stop the harm, just as the tool rule did in the Bhopal example.

Frequently Asked Questions About Prompt Injection

What is prompt injection in cyber security?

In cyber security, prompt injection is an attack on AI tools rather than on servers or networks. The attacker hides orders in text the AI reads, such as a chat message, email or file. If it works, the AI may leak data or take wrong actions. Security teams treat it like any other attack, with access limits, filters, logs and alerts.

What is prompt injection testing?

Prompt injection testing means trying safe, planned attacks on an AI tool before real users reach it. A security team writes test messages and test documents that carry hidden orders. Then it checks whether the tool obeys them, leaks data or takes actions it should not. The team fixes the gaps it finds and repeats the tests after each change.

What are prompt injection guardrails?

Prompt injection guardrails are safety checks placed around an AI tool. They screen what goes into the AI for hidden orders, and they screen what comes out for private data. Amazon Bedrock Guardrails and Azure AI Content Safety Prompt Shields are two examples. Guardrails lower the risk, but they work best alongside access limits and human approval.

How do security teams detect these attacks?

Teams use filters that scan user messages and documents for patterns that try to change the AI’s rules. They also keep logs of every action an AI tool takes. Then alerts flag odd behavior, such as a tool trying to send data outside or open records it never uses. A person reviews each alert and blocks the source if needed.

What does payload mean in AI attacks?

In security, a payload is the harmful part of an attack. In an AI attack, the payload is the hidden instruction itself, the line that tries to make the tool ignore its rules. Attackers can hide it in plain text, tiny white text, images or file details. Defenders study the patterns, not the exact wording, because attackers keep changing it.

Does prompt injection affect every AI tool?

Any AI tool that reads text from users, documents or the web can face this risk. It matters most when the tool can also act, for example by sending email, changing records or browsing websites. A simple tool that only answers from fixed company content carries less risk. Even so, every tool needs limits and regular testing.

Can a company stop it completely?

Not today. Security experts, including the OWASP community, say no reliable way exists yet to stop it fully. So companies plan for some attacks to get through. They give AI tools the least access needed, ask a person to approve risky actions and watch the logs. That way, a successful trick still causes little harm.
Use CaseGovern and Secure Enterprise AI Use

References

  1. Prompt injection ranked first, and no reliable prevention: OWASP Gen AI Security Project, LLM01:2026 Prompt Injection
  2. Amazon Bedrock Guardrails prompt attack filter: AWS, Detect prompt attacks with Amazon Bedrock Guardrails
  3. Azure AI Content Safety Prompt Shields: Microsoft Learn, Prompt Shields in Azure AI Content Safety
Stay Updated

Get the Latest Terms & Insights.

New encyclopedia terms, threat intelligence, and architecture decisions, by email.

Book a Consultation

A practice principal will contact you within 1 business day.

Thank you! A Signisys principal will be in touch within 1 business day.