Defensive architecture

Prompt Injection Defense

Prompt injection defense requires layered controls because model interpretation remains probabilistic. Engineering must both reduce successful manipulation and limit security impact when manipulation occurs.

Assume some injections will get through

Content filters, classifiers, and model critics are useful probabilistic signals. Deterministic controls outside the model should govern identity, authorization, resources, actions, destinations, and side effects.

Defense-in-depth architecture

Separate model interpretation from permission to act. Preserve source context, validate proposed plans, and enforce consequential decisions at application boundaries.

Risky path
  1. Untrusted Input / External Content
  2. LLM / Agent
  3. Privileged Tool

The model can turn untrusted language directly into privileged action.

Stronger path
  1. Untrusted Content
  2. Provenance / Inspection
  3. LLM
  4. Plan Validation
  5. Policy Engine
  6. Authorization
  7. Optional Approval
  8. Restricted Tool
  9. Monitoring

Independent controls preserve context, validate intent, authorize effects, and constrain execution.

  1. 01
    Context and provenance

    Source, principal, tenant, classification, and trust status remain structured application data.

  2. 02
    Inspection and model robustness

    Content and behavior provide risk signals without becoming the sole trust decision.

  3. 03
    Plan and policy

    A proposed plan is checked against user intent, permitted workflow, and information-flow rules.

  4. 04
    Authorization

    Principal, resource, action, parameters, and destination are authorized outside the model.

  5. 05
    Restricted execution

    Restricted tools, sandboxing, egress rules, and specific approvals cap impact.

  6. 06
    Monitoring and recovery

    Telemetry connects source, context, plan, action, and side effect for detection and incident response.

Defense domains

Resilience comes from complementary control families with distinct responsibilities.

01
DomainContext and provenance

Keep the origin and trust status of untrusted data outside model-generated text.

02
DomainModel-facing robustness

Design prompts, data marking, and model behavior to reduce the influence of competing instructions.

03
DomainDetection and monitoring

Correlate content risk, plan drift, tool chains, and anomalous side effects.

04
DomainIdentity and authorization

Bind authority to the initiating principal and check every consequential action.

05
DomainTool and action controls

Constrain capabilities, parameters, resources, and transactions explicitly.

06
DomainInformation flow and egress

Enforce permitted paths from source data to outputs, tools, and external destinations.

07
DomainContainment and recovery

Isolate execution, preserve evidence, rotate credentials, and restore safely.

08
DomainHuman oversight

Require informed and specific approval for selected risks.

09
DomainTesting and assurance

Exercise controls with representative attack paths and retest after change.

Probabilistic signals and deterministic enforcement

Detection signals help prioritize, block, or investigate suspicious behavior. They should not be the only protection around consequential operations.

Control roles at consequential boundaries
Control propertyProbabilistic signalsDeterministic enforcement
Typical examplesPrompt injection classifier; content inspection; model-based critic; plan-drift signalAuthentication; resource and action authorization; parameter validation; destination allowlist
Decision characterUncertain score with thresholds, false positives, and missed casesExplicit rule over identity, state, resource, action, or destination
Appropriate roleDetect, prioritize, trigger review, or reduce riskEnforce tenant, permission, sandbox, network, and side-effect boundaries
Security assumptionSome malicious content or behavior will remain undetectedDisallowed operations remain blocked even when model behavior is manipulated

Defense by attack surface

The same principles apply across systems, but priority controls differ with the path into context and the authority available downstream.

01
Attack surfaceDirect Prompt Injection

Treat user input as untrusted, limit model authority, and authorize actions independently.

02
Attack surfaceIndirect Prompt Injection

Preserve external-content provenance, distrust tool output by default, and control information flow.

03
Attack surfaceRAG systems

Enforce retrieval permissions, tenant boundaries, document provenance, and permitted use of retrieved data.

04
Attack surfaceTool-using AI Agents

Control identity, plan validation, per-action authorization, parameters, egress, and side effects.

05
Attack surfaceMulti-agent systems

Retain message, delegated-authority, and provenance context across agent boundaries and reauthorize each handoff.

Operational security lifecycle

Defense is a maintained process, not a one-time prompt change.

Operational security lifecycle
  1. 01
    Threat Model

    Map assets, principals, trust boundaries, content sources, tools, and possible side effects.

  2. 02
    Prevent

    Reduce exposure, authority, and risky paths through architecture and least privilege.

  3. 03
    Detect

    Correlate content, behavior, plan, tool, and action signals.

  4. 04
    Authorize / Contain

    Block disallowed operations and tightly constrain permitted execution.

  5. 05
    Investigate

    Reconstruct source, model context, plan, decisions, tool calls, and effects.

  6. 06
    Recover

    Contain workflows, rotate credentials, restore integrity, and notify affected parties.

  7. 07
    Retest

    Exercise the root cause and control gaps with representative scenarios.

High-value design principles

These principles reduce the authority available to manipulated model behavior and improve investigation when controls fail.

01
PrincipleLeast privilege

Expose only the minimum tools, credentials, data, and actions needed for the current task.

02
PrincipleMinimize model-visible secrets

Keep secrets out of prompts when an external reference or short-lived capability will suffice.

03
PrinciplePreserve provenance outside the model

Maintain source and policy metadata structurally rather than expecting the model to reconstruct it from text.

04
PrincipleTreat external content as untrusted by default

Derive trust from source and use context, not from the tone or format of content.

05
PrincipleTrusted tool ≠ trusted tool output

A correctly implemented tool can return attacker-controlled websites, email, or records.

06
PrincipleModel output ≠ authorization

A model's tool call, plan, or explanation is a proposal, not a permission decision.

07
PrincipleValidate consequential actions

Check principal, resource, action, parameters, destination, and current state before execution.

08
PrincipleConstrain network egress

Permit only necessary destinations and protocols, and govern sensitive data flows separately.

09
PrincipleMake human approval specific

Show the concrete action, destination, data, and effect so consent is informed.

10
PrincipleBuild reconstructable telemetry

Trace source → context → plan → action → side effect with appropriate data minimization.

Defense knowledge areas

This taxonomy organizes the complete standalone defense library. Published controls link to their reviewed pages; Prompt Injection Prevention remains an architecture concept represented by the layered hub rather than a separate article.

Architecture and prevention

  • Defense controlPrompt Injection Prevention

    Layer controls that reduce manipulation opportunities and limit consequences when prevention is incomplete.

Context and provenance

Detection and monitoring

Identity, authorization, and oversight

Information flow and action controls

Containment and recovery

Testing and assurance

Standards and guidance orientation

OWASP guidance and NIST terminology provide useful orientation, but neither should be treated as a complete defense standard or evidence that one control guarantees protection.

Reviewed orientation

OWASP GenAI Security Project
LLM01:2026 Prompt Injection
NIST
NIST AI 100-2e2025 terminology

References

  1. LLM01:2026 Prompt InjectionOWASP GenAI Security Project · GuidanceReviewed 2026-09-20
  2. Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations, NIST AI 100-2e2025NIST · Standard · 2025-03Reviewed 2026-09-20