Skip to main content
reopt Handbook
reopt Handbook
AI Security and Compliance Operations

Strategy and Governance

Risk GovernanceData ProtectionSecure Architecture

Security Controls

Prompt Injection DefenseAccess Control and SecretsAudit Readiness

Operations and Leadership

Incident ResponseBoard Reporting

Appendix

GlossaryVerificationUpdates
Handbook›AI Security and Compliance›Prompt Injection Defense
한국어KOEnglishEN

Prompt Injection Defense

Defend AI systems against malicious instructions in user input, retrieved content, and tool output.

Written and reviewed by Eric Han · Co-founder & CTO, reopt

Key takeaways

  • Prompt injection is a system design problem that appears when untrusted text can override policy, change tool behavior, or extract sensitive information.
  • Defend across five surfaces: user input, retrieved documents, tool output, persistent memory, and multi-agent handoff.
  • Apply the core defense pattern: separate instructions from data, label untrusted content, restrict tools by user and risk, and require approval for side effects.
  • Validate outputs before execution or disclosure, and log suspicious input and blocked actions.
  • Use concrete test cases, such as whether a document can make the model reveal system prompts or retrieved text can override tenant permissions.

October 20, 2026: reproducible red-team checks

OWASP's GenAI Red Teaming Manual 1.0 covers eight phases: planning, reconnaissance, attack surface mapping, exploitation, persistence, impact assessment, reporting, and remediation. Its scope includes models, applications, multimodal interfaces, and agents.

For this handbook's regression pattern, use authorized test environments and synthetic data. Record input, model/harness/policy versions, allowed tools, expected enforcement point, actual side effects, evidence, and retest result. Include instructions hidden in retrieved/MCP content, images, persisted memory, and summaries; check cross-tenant access and external transfers. A verbal refusal is insufficient if the tool or network action still occurred.

Count only valid executed cases in the success-rate denominator. Infrastructure failures are not successful defenses. Retest the original case and new variants after remediation.

OWASP GenAI Red Teaming Manual 1.0.

Prompt injection is a system design problem. It appears when untrusted text can override policy, change tool behavior, or extract sensitive information.

Attack Surfaces

SurfaceExample riskControl
User inputDirect instruction to ignore policySystem policy and input validation
Retrieved documentsMalicious text inside knowledge baseSource trust and content sanitization
Tool outputWeb page or API response injects instructionsTool result boundaries
MemoryStored poisoned instruction persistsMemory review and deletion
Multi-agent handoffOne agent passes unsafe instructions to anotherStructured handoff schema

Defense Pattern

  1. Separate instructions from data.
  2. Label untrusted content explicitly.
  3. Restrict tools by user, task, and risk.
  4. Require approval for side effects.
  5. Validate outputs before execution or disclosure.
  6. Log suspicious input and blocked actions.

Test Cases

  • Can a document tell the model to reveal system prompts?
  • Can a user make the agent call a privileged tool?
  • Can retrieved text override tenant permissions?
  • Can tool output create a hidden instruction for the next step?

Related docs

Secure Architecture

Design AI systems with policy boundaries, isolation, logging, and safe tool access.

Cmd. /memory

Claude Code Command Master · Manages CLAUDE.md and auto memory. Saved project instructions can affect later sessions.

Agent Documentation Security

Agentic Documentation · Reduce prompt injection, MCP tool poisoning, Plugin supply chain risk, and excessive agency.

Sandbox Tool Runtime

Vercel Enterprise AI Platform · Isolate code, file, browser, and shell execution for AI agents.

Project Rule Documents

Agentic Documentation · Design AGENTS.md, CLAUDE.md, and path-scoped rules without conflicts or drift.

Secure Architecture

Design AI systems with policy boundaries, isolation, logging, and safe tool access.

Access Control and Secrets

Govern human, service, and agent permissions with least privilege and rotation.

On this page

October 20, 2026: reproducible red-team checksAttack SurfacesDefense PatternTest Cases