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.
- The company sets rules: it tells the AI tool what it may and may not do.
- New text arrives: a user types a message, or the tool reads an email, file or web page.
- The text hides an order: somewhere inside, a line tells the AI to ignore its earlier rules and do something else.
- 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 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.
- Treat outside text as data: keep company rules separate, and label emails, files and web pages as untrusted.
- Give the least access: let each AI tool reach only the data and actions it truly needs.
- Ask a person to approve: require a human to confirm risky steps, such as sending money or mail outside.
- Filter inputs and outputs: screen what goes in and what comes out for attack patterns and private data.
- Test before launch: try safe attack tests on the tool before staff and customers use it.
- 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.

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?
What is prompt injection testing?
What are prompt injection guardrails?
How do security teams detect these attacks?
What does payload mean in AI attacks?
Does prompt injection affect every AI tool?
Can a company stop it completely?
References
- Prompt injection ranked first, and no reliable prevention: OWASP Gen AI Security Project, LLM01:2026 Prompt Injection
- Amazon Bedrock Guardrails prompt attack filter: AWS, Detect prompt attacks with Amazon Bedrock Guardrails
- Azure AI Content Safety Prompt Shields: Microsoft Learn, Prompt Shields in Azure AI Content Safety
Get the Latest Terms & Insights.
New encyclopedia terms, threat intelligence, and architecture decisions, by email.
