Learn

What Is Prompt Injection?

A concept-first introduction: what prompt injection is, how direct and indirect variants differ, why an instruction-control failure is not the same as security impact, and why defenses must be layered outside the model.

By Norbert HofmannPublished: 2026-09-26Last reviewed: 2026-09-26Level: FundamentalsAudience: General Technical Readers, Developers, Security Engineers
Area
Learn - conceptual foundation
Core idea
Model-visible text can steer model behavior; it never grants authority
Variants
Direct and indirect
Security impact depends on
Data, tools, side effects, destinations, privilege, persistence
Examples
Short, synthetic, conceptual only
Table of contents

A concise definition

Prompt injection is a class of attack in which content that reaches a language model causes it to follow instructions the application owner did not intend. Application instructions, user input and external content become part of the same model-visible context, though providers may represent roles or channels differently. There is no reliable, built-in mechanism that keeps instruction-like text in data from influencing its behavior.

NIST describes prompt injection as an attack that exploits the concatenation of untrusted input with a prompt constructed by a higher-trust party such as the application designer. That wording captures the essential point: the problem arises where trust levels are mixed into one model-visible context.

Why prompt injection exists

Classic injection bugs such as SQL injection exist because code and data share a channel. For that class, parameterized queries provide a hard separation between code and data. Language models have no equivalent general-purpose separation: instructions and data are both natural language, and the model decides what to treat as an instruction based on learned behavior, not on a grammar the application controls.

Role markers, system prompts and formatting conventions help models prioritize, but they are behavioral signals. They shift probabilities; they do not create an enforced boundary. This is why the site treats every model-visible input as potentially influential, whatever its position in the prompt.

Direct and indirect prompt injection

The two common variants differ in where the influencing text comes from.

Direct vs indirect at a glance
AspectDirectIndirect
OriginThe person interacting with the applicationThird-party content the application retrieves or receives
Typical channelChat input, form fields, API requestsWebsites, emails, documents, retrieved passages, tool output
Who is exposedMostly the application and its policiesThe user whose session processes the content, and their data and tools
Key questionCan this user steer the model beyond intended behavior?Can content the user never wrote steer the model on their behalf?

Indirect prompt injection is often the more serious concern in agentic systems, because the attacker does not need access to the application at all. For depth, see Direct Prompt Injection and Indirect Prompt Injection.

Instruction-control failure vs security impact

It helps to separate two questions that are often blurred:

  1. Did the model follow unintended instructions? This is an instruction-control failure. It is a property of model behavior.
  2. Did anything security-relevant happen as a result? This is security impact. It is a property of the application: what data was exposed, which action ran, where content went.

A chatbot with no tools, no private data and no persistent memory can be steered into odd answers with limited direct confidentiality or integrity impact. The same model inside an agent that can read mail and send messages can turn an identical control failure into data exfiltration. Severity is decided by architecture, not by the injected text.

Model-visible text does not become trusted

Content does not gain authority because it appears in the model's context, because it is placed near the system prompt, or because it was fetched by a trusted tool. A retrieved web page is still third-party content after it has been concatenated into a prompt. An email is still the sender's text, even if the mail server authenticated the sender.

Trust is a property the application establishes with system evidence: authenticated identity, verified origin, access-controlled storage, recorded provenance. Those facts live in application-controlled metadata, not in the prose the model reads. The Trust Boundaries and Model Context article develops this idea in detail, and Data Provenance covers how origin is recorded.

A model response is a proposal, not authorization

When a model suggests a tool call, a message, a file change or a destination URL, that output is a proposal. It is variable data shaped by everything in context, including content an attacker may have influenced. It does not become authorized because the model produced it confidently or because it matches a valid format.

Conceptual flow from content to effect
Variable trustModel-visible content
SystemModel
Variable trustProposal
SystemAuthorization and flow checks
Variable trustPermitted effect

Deterministic checks outside the model decide whether an action is permitted for this user, resource and destination. See Agent Authorization, Information Flow Control and Output Validation. Validation checks format; authorization checks permission; neither turns model-authored content into trusted content.

Where prompt injection becomes security-relevant

Prompt injection becomes materially relevant when the model's output can reach something that matters. Useful questions:

Impact dimensions
DimensionQuestion to ask
Data accessCan the model read private, tenant or confidential data during the task?
ToolsCan model output select or parameterize tool calls?
Side effectsCan an action change state: send, write, delete, purchase, deploy?
DestinationsCan output reach an external recipient, URL, rendered link or image fetch?
PrivilegeDoes the workflow run with more authority than the current user or task needs?
PersistenceCan influenced output be stored in memory, notes or shared data and reused later?

If the answer to all of these is no, the realistic impact is limited to the response itself. Each yes widens the blast radius and calls for a deterministic control at that point.

A short synthetic example

This example is conceptual. It shows the shape of the problem, not a technique.

01User request

Summarize my three newest emails.

02Retrieved email (third-party content)

[Synthetic placeholder: an email body containing instruction-like text addressed to the assistant]

03Model proposal

The model proposes a forwarding action that the user never asked for.

04Application decision

Authorization denies the send: the task scope is read and summarize, and the destination is not permitted.

The control failure happened inside the model. The security outcome was decided by the authorization check outside it.

Prompt injection vs jailbreak

The two terms overlap and are not used uniformly across vendors, researchers and standards bodies. A common working distinction:

  • Jailbreaking usually refers to attempts to make a model ignore its safety behavior or usage policies, often by the person using it.
  • Prompt injection usually refers to content that subverts the application's intended instructions, and it is especially relevant when that content comes from a third party.

Some sources treat jailbreaking as a form of prompt injection; others keep them separate. There is no universal terminology standard, so this site states which meaning it uses rather than claiming one is authoritative. What matters for security engineering is the same in both cases: where the text came from, and what the application lets the resulting output do.

See the dedicated comparison: Prompt Injection vs Jailbreaking.

Hidden context is not a secret

System prompts and other hidden instructions can sometimes be disclosed, inferred or partially reconstructed through model output. They should never contain credentials or act as the only control. See System Prompt Extraction for the full treatment.

Why defenses are layered

No single classifier, filter or prompt wording reliably separates instructions from data in natural language. Microsoft's guidance for indirect prompt injection recommends a defense-in-depth strategy that layers probabilistic and deterministic mitigations. The site follows the same principle:

  1. 01
    Know the origin

    Record where each piece of content came from, outside model-visible text.

  2. 02
    Observe

    Inspection and detection produce probabilistic signals that route, flag or narrow authority.

  3. 03
    Constrain

    Least privilege limits which data and tools a workflow can reach at all.

  4. 04
    Decide deterministically

    Authorization and information flow control decide each action and destination.

  5. 05
    Handle output safely

    Output validation and sink-specific handling before output is used.

Common misconceptions

Misconceptions to unlearn

  • A stronger system prompt solves prompt injection.
  • Content fetched by a trusted tool is trusted content.
  • If the output is well-formed, it is safe to execute.
  • A detector score below a threshold means the content is clean.
  • Prompt injection only matters for chatbots.
  • Hidden instructions are confidential.

Try it in a controlled lab

The Direct Prompt Injection Basics lab is a guided simulation. It shows model-visible context, competing instructions and an authorization decision outside the model, without connecting to real models or systems. The Direct vs Indirect Prompt Injection lab then practices classifying scenarios by origin and path and judging impact as a separate question.

Standards and sources

How this article uses sources

OWASP
GenAI LLM Top 10 2026 - LLM01:2026 Prompt Injection as a named risk.
NIST
AI 100-2e2025 and the NIST Glossary - terminology for prompt injection and indirect prompt injection only
Microsoft
Defend against indirect prompt injection attacks - untrusted external content and defense in depth

Frequently asked questions

Is prompt injection a bug in a specific model?
No. It is a consequence of how language models process mixed instructions and data. Models differ in robustness, but none provides an enforced boundary.
Can prompt injection be fully prevented?
No current model-level technique provides a complete, generally reliable prevention boundary. The practical goal is to reduce likelihood and constrain impact with layered controls outside the model.
Is every successful prompt injection a security incident?
No. It becomes security-relevant when it affects data, actions, destinations, privilege or persisted state.
What is the difference between direct and indirect?
Direct comes from the person using the application; indirect comes from third-party content the application processes.
Is prompt injection the same as jailbreaking?
They overlap. Usage differs across sources; this site uses jailbreak for bypassing model safety behavior and prompt injection for subverting application instructions.
Does input filtering help?
It can reduce some risk as one layer, but it cannot reliably separate instructions from data in natural language.
Why is a model's tool call not authorized automatically?
Because it is a proposal shaped by everything in context, including content an attacker may control.
Where should I go next?

References

  1. OWASP GenAI LLM Top 10 2026OWASP GenAI Security Project · GuidanceReviewed 2026-09-26
  2. Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations, NIST AI 100-2e2025NIST · Standard · 2025-03Reviewed 2026-09-26
  3. prompt injectionNIST Glossary · Technical documentationReviewed 2026-09-26
  4. indirect prompt injectionNIST Glossary · Technical documentationReviewed 2026-09-26
  5. Defend against indirect prompt injection attacksMicrosoft Learn · GuidanceReviewed 2026-09-26