Answers

Prompt injection: questions and answers

A web page or file your LLM reads can carry hidden instructions that make it leak a private conversation or misuse its tools. OWASP ranks prompt injection first (LLM01) among LLM application risks and says it is unclear whether fool-proof prevention exists.

  • 8 questions
  • Last reviewed

Executive summary

What it is
Prompt injection is text that changes what a language model does, typed by a user or hidden in a page, file or tool output the model reads. OWASP lists it as LLM01.
The risk
An injected instruction can make an application leak conversation data, call tools it should not, or produce harmful output. OWASP says it is unclear whether fool-proof prevention exists, so filtering alone leaves residual risk.
What to buy or do
Budget for containment first: least-privilege access, deterministic output checks and human approval for high-risk actions. Add an input and output guardrail as one layer, and run adversarial tests against the whole application before each release.

What is prompt injection?

Prompt injection is input that changes how a language model behaves or what it outputs in ways its builders did not intend, even when a person cannot see that input. OWASP says it can make a model violate guidelines, generate harmful content, disclose sensitive information or give unauthorized access to the functions the model can call. OWASP ranks it first (LLM01) in its 2025 Top 10 for LLM Applications.

What is the difference between direct and indirect prompt injection?

Direct injection comes from the user's own input, on purpose or by accident; indirect injection arrives in external content the model reads, such as a web page or a file. OWASP's indirect example is a summarized web page whose hidden instructions make the model insert an image that links to an attacker's URL, which leaks the private conversation. Indirect injection needs no malicious user at all.

Can prompt injection be fully prevented?

No complete fix is known. OWASP says it is unclear whether fool-proof prevention exists, and that research shows retrieval-augmented generation (RAG) and fine-tuning do not fully mitigate it. Plan for containment: give the application least-privilege access, define and validate output formats with deterministic code, and require human approval for high-risk actions, so a successful injection has little it can do.

How do prompt injection detectors work?

A detector screens text for signs of an injection attempt on the way into the model, on the way out, or both. OWASP lists input and output filtering as a mitigation and names semantic filters and string checks as examples. A detector lowers risk without removing it, so run it next to least privilege and human approval for risky actions.

How is prompt injection different from jailbreaking?

OWASP treats jailbreaking as a form of prompt injection. A jailbreak tries to make the model disregard its safety protocols entirely, while prompt injection covers any input that changes what the model does, such as leaking data or calling a tool. One set of defenses covers both: filtering, least privilege, output checks and regular adversarial testing.

How do I test my app for prompt injection?

Attack the whole application, not only the model, and treat the model as an untrusted user, as OWASP recommends with regular penetration testing and breach simulations. A scanner such as garak automates known probes for prompt injection and jailbreaks. For the indirect case, plant instructions in the documents, pages and tool outputs your application reads and check whether it acts on them.

Which OWASP risk covers prompt injection?

LLM01:2025 Prompt Injection, the first entry in the OWASP Top 10 for LLM Applications 2025. Three other entries connect to it: OWASP names prompt injection as a trigger for excessive agency (LLM06), lists vulnerability to indirect injection as a condition that raises the impact of improper output handling (LLM05), and warns that prompt restrictions on sensitive data can be bypassed through it (LLM02).

Do guardrails stop injections hidden in documents and web pages?

Not reliably. Instructions hidden in documents and web pages are indirect prompt injection, and OWASP says it is unclear whether any fool-proof prevention exists. Filters catch some cases. Structural controls carry more of the load: separate and clearly mark untrusted content, give the application least-privilege tokens, and require human approval for high-risk actions.

Sources & last reviewed

Last reviewed . We compile from the vendors' own public pages and repositories and we do not run the products. Source links open in a new tab. Found a mistake? Report a correction.

Drafted with AI assistance; facts checked against primary sources on October 21, 2026.