Prompt Injection
Prompt injection
Prompt injection is an attempt to make a model or model-integrated application follow unintended instructions in its inputs. Direct injection comes through a prompt; indirect injection can arrive through retrieved pages, files, or other external content. [1][2]
What does Prompt Injection mean in simple terms?
A document may contain text that looks like an instruction to the assistant. If the application treats that text as authority rather than source material, the assistant can stray from the intended task. Consequences depend on what data and tools the application exposes; not every bad answer is an operating-system compromise.
How can Prompt Injection be explained with an analogy?
It is a note hidden inside a document telling the clerk to abandon the authorized procedure. The document should be evidence, not the clerk’s manager.
Where is Prompt Injection used?
Untrusted web content
In a hypothetical test, a summarizer encounters unrelated instructions embedded in a page. The team checks whether it summarizes the page without accepting those instructions as authority.
Retrieved documents
The indirect-injection research examines how retrieved data can influence application behavior. A team treats retrieved passages as untrusted content and validates any resulting actions. [2]
Tool permissions
A hypothetical assistant proposes an external action after reading a document. The application checks independent authorization and limits tools rather than allowing source text to grant permission.
Layered controls
OWASP recommends least privilege, separation of external content, output validation, and approval for privileged actions. These reduce exposure but do not establish foolproof prevention. [1]
Learning steps, limitations and developments
- Inventory the external pages, files, messages, and tool results the assistant reads.
- Map which data and actions it can access and enforce necessary permissions in application code.
- Separate trusted instructions from untrusted content and validate outputs before using them for actions.
- Run authorized adversarial tests in a controlled environment, including document-based attempts, and record outcomes.
- Fix failures, add regression tests, and require the appropriate approval for privileged operations.
Limitations and direction
There is no established foolproof prevention method. Layered controls reduce exposure, and their effectiveness depends on the whole application. RAG or fine-tuning alone does not remove the threat. Keep testing as inputs, models, and tool permissions change; distinguish injection from a user voluntarily sending confidential data. [1]
Which concepts are related to Prompt Injection?
- Related conceptPrompt VersionA related concept within the same category.
- Related conceptPrompt LibraryA related concept within the same category.
- Related conceptPersona PromptingA related concept within the same category.
Which sources explain Prompt Injection?
- OWASP LLM01:2025 — https://genai.owasp.org/llmrisk/llm01-prompt-injection/
- Indirect prompt injection research — https://arxiv.org/abs/2302.12173
Tell us what you think
Your feedback helps us improve the content.