What is prompt injection?
Prompt injection is an attack, or an accident, in which text fed to an AI model changes what the model does in ways its builders did not intend. The model reads the injected text as instructions instead of as information. OWASP, the open security community behind the best-known lists of web and AI risks, ranks prompt injection first in both its 2025 and its 2026 Top 10 lists for applications built on large language models (LLMs).
The injected text does not have to come from the person typing. It can sit inside a web page, an email, a PDF, an image, or a reply from another tool, and it does not have to be visible to a human. If the model reads it, it can influence the model.
What is the difference between direct and indirect prompt injection?
OWASP describes two main types:
- Direct prompt injection: the person using the AI system types input that changes its behavior. It can be deliberate, such as someone telling a support chatbot to ignore its rules, or accidental, such as a user pasting in a document that happens to contain conflicting instructions. Jailbreaking, where the goal is to get a model to break its safety rules, is a form of direct injection.
- Indirect prompt injection: the model picks up instructions from outside content it was asked to process, such as a web page it summarizes, an email it triages, a document retrieved from a knowledge base, or the output of another tool. The user never wrote or saw those instructions.
Indirect injection is the one most businesses underestimate. OWASP’s 2026 entry points out that it can arrive through sources you trust, not only the public web. An attacker might put text into a bug report form, a shared document, or a database record that your own AI assistant later reads with your permissions.
What does a prompt injection attack look like?
OWASP’s example scenarios give a sense of the range:
- A user asks an AI assistant to summarize a web page. The page contains hidden instructions that make the assistant leak the private conversation through a link it inserts in its answer.
- An attacker edits a document in a repository that a retrieval-augmented generation (RAG) system searches. When someone’s question pulls up that document, the hidden instructions change the answer they get.
- A job applicant hides instructions in a résumé so that an AI screening tool gives a positive recommendation that the résumé itself does not support.
- Instructions are written in another language, encoded, or hidden in an image so that simple keyword filters miss them.
None of these need access to the company’s servers. The attacker only needs to put text somewhere the model will read it.
Why is prompt injection more dangerous for AI agents?
A chatbot that only produces text can be tricked into saying the wrong thing. An AI agent can be tricked into doing the wrong thing, because it has tools: it can send email, update records, call APIs, or move files. OWASP’s 2026 entry notes that once a model’s output drives tool calls, the damage can reach anything those tools can reach.
OWASP’s separate Top 10 for Agentic Applications (2026) lists this as its first risk, “Agent Goal Hijack”: an attacker redirects what an agent is trying to achieve. Its examples include an email from outside the company that causes an agent to send unauthorized messages under a trusted identity, and a manipulated instruction that pushes a finance agent to transfer money to the attacker.
OWASP’s 2026 guidance also cites a simple test, which it credits to security researcher Simon Willison as the “lethal trifecta”: an agent that can read private data, take in untrusted content, and communicate externally all at once has the conditions for a serious breach. Removing any one of the three removes those conditions. It pairs this with a related “Rule of Two,” which it credits to Meta: an agent that has all three capabilities should need a person to approve each action.
Can prompt injection be fully prevented?
Not with today’s models, according to OWASP. Its 2026 entry explains that LLMs make no built-in distinction between instructions and data: both arrive as the same stream of text. That is why there is no simple equivalent of the parameterized queries that stop SQL injection, a point OWASP attributes to the UK’s National Cyber Security Centre. Its 2025 entry adds that techniques like RAG and fine-tuning do not fully solve the problem either.
The practical conclusion is to design the surrounding system on the assumption that the model will eventually be fooled, and make sure a fooled model cannot do much harm. OWASP calls this defense in depth: no single control is enough.
How do you prevent prompt injection?
These controls, drawn from OWASP’s 2025 and 2026 guidance, reduce how often injection works and limit the damage when it does:
- Give the model the least access possible. Keep API keys and the ability to change data in your application code, not in the model, and grant only the permissions each task needs. OWASP treats this as one of the controls that still holds up against determined attackers.
- Require human approval for high-impact actions. Anything that sends, pays, deletes, or changes permissions should wait for a person, and the reviewer should see the exact action, not a summary.
- Keep outside content separate and labeled. Mark web pages, emails, and uploaded files as untrusted data so they are less likely to be treated as instructions. OWASP notes this helps but can be worked around by an attacker who knows the labeling scheme.
- Check outputs with ordinary code. Define the format you expect, such as a fixed set of fields, and validate every response before another system acts on it.
- Filter inputs and outputs. Screen for sensitive data and known attack patterns in text, images, and other inputs, and strip invisible characters that can hide instructions. Filters catch some attacks, not all.
- Write clear limits into the system prompt. State what the assistant may and may not do. This is a partial control on its own, so pair it with the access limits above.
- Treat memory as sensitive. If your agent remembers things between sessions, an injected instruction saved to memory can affect every later session. Log and review what gets saved.
If you are planning which systems an agent may touch in the first place, our guide to setting up AI agents in the workplace covers choosing the first workflow, limiting access, and keeping a person approving the actions that matter.
How do you test an AI system for prompt injection?
OWASP recommends regular adversarial testing that treats the model as an untrusted user, checking whether your trust boundaries and access controls hold. Useful test cases include:
- a document or web page with hidden text telling the assistant to ignore its instructions;
- an email that asks an agent to forward data or contact an outside address;
- instructions written in another language, encoded in Base64, or placed in an image;
- an instruction split across two inputs that only works when they are combined;
- a record in your own knowledge base that has been changed to include instructions.
OWASP’s 2026 entry also warns against relying on a fixed list of known attacks. Its testing guidance calls for red-teaming in which the testers know how the defenses work, because attackers adapt and defenses that block known attacks can still fail against new ones. Re-run the tests whenever you add a tool, a data source, or a model.
Security testing of AI features belongs alongside testing of the rest of the application. SISwarm, part of the EAAS product family, is being developed for scoped security testing with human oversight: specialist agents examine approved targets, and reviewers validate the findings. It is currently in design-partner pilots.
Where should a business start?
Start with an inventory of every place an AI model reads content it did not write: web browsing, inboxes, uploaded files, shared drives, support tickets, and other tools. For each one, ask what the model could do if that content told it to misbehave. Where the answer is “send data outside,” “change records,” or “spend money,” add an approval step or remove the capability.
Prompt injection is a design problem as much as a model problem, so the fixes usually live in how the system is built around the model. If you want help designing those controls, our AI and automation team works on agent workflows, permissions, and review steps.
Frequently asked questions
What is prompt injection in simple terms?
Prompt injection is when text an AI model reads gets treated as instructions instead of information, so the model does something its builders did not intend. The text can come from the user or be hidden inside a web page, email, document, or image the model processes.
What is the difference between prompt injection and jailbreaking?
Jailbreaking is a type of prompt injection where the goal is to make a model ignore its safety rules. Prompt injection is the broader category and includes attacks that leak data, change answers, or make an AI agent misuse its tools.
What is indirect prompt injection?
Indirect prompt injection happens when the instructions come from outside content the AI processes, such as a web page it summarizes or an email it reads, rather than from the person using it. The user may never see the instructions.
Can prompt injection be completely prevented?
Not with current models, according to OWASP, because language models do not reliably separate instructions from data. The practical approach is to limit what a fooled model can do through least-privilege access, human approval for high-impact actions, and output checks in ordinary code.
How do you test for prompt injection?
Include injected instructions in your test cases: hidden text in documents and web pages, emails asking an agent to send data out, encoded or translated instructions, and altered records in your own knowledge base. Re-test whenever you add a tool, data source, or model.
Sources
- OWASP Gen AI Security Project, LLM01:2025 Prompt Injection
- OWASP Gen AI Security Project, LLM01:2026 Prompt Injection
- OWASP Gen AI Security Project, 2026 Top 10 for LLM Applications
- OWASP Gen AI Security Project, ASI01: Agent Goal Hijack (Top 10 for Agentic Applications 2026)
This article is general information, not legal or security advice for your organization.
