Prompts & AI use

Prompt Injection

AI-assisted editorial review:

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?

Case 1

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.

Case 2

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]

Case 3

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.

Case 4

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

  1. Inventory the external pages, files, messages, and tool results the assistant reads.
  2. Map which data and actions it can access and enforce necessary permissions in application code.
  3. Separate trusted instructions from untrusted content and validate outputs before using them for actions.
  4. Run authorized adversarial tests in a controlled environment, including document-based attempts, and record outcomes.
  5. 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 concept
    Prompt VersionA related concept within the same category.
  • Related concept
    Prompt LibraryA related concept within the same category.
  • Related concept
    Persona PromptingA related concept within the same category.

Which sources explain Prompt Injection?

  1. OWASP LLM01:2025 — https://genai.owasp.org/llmrisk/llm01-prompt-injection/
  2. Indirect prompt injection research — https://arxiv.org/abs/2302.12173