OWASP Updates GenAI Guidance, Details 5 Prompt Injection Defenses

Serge Bulaev

Serge Bulaev

OWASP has updated its GenAI security guidance, listing prompt injection as a top risk and emphasizing the need for layered defenses instead of a single fix. The guidance suggests using model-level controls, like tagging untrusted text so the model treats it as data, and system-level controls, such as limiting what tools the model can access. Five practical controls are outlined, including separating untrusted text, using approval for risky actions, and testing for prompt injection attacks. Real-world incidents suggest these attacks may be common and show that combining multiple defenses works better than relying on one method. Some methods appear to greatly reduce attack success, but determined attackers might still find ways around simple protections.

OWASP Updates GenAI Guidance, Details 5 Prompt Injection Defenses

In its latest GenAI security guidance, OWASP details five critical prompt injection defenses, identifying the vulnerability as the number one risk for Large Language Models (LLMs). The guidance designates prompt injection as LLM01, stressing that effective protection requires layered controls rather than a single fix - a view supported by analysis of the OWASP LLM Top 10.

Effective security for production chatbots, RAG pipelines, and agentic systems requires combining model-level techniques that alter how an LLM processes text with system-level guardrails that limit the potential impact of any successful attack.

Model-Level Defenses: Teaching the Model to Distinguish Commands from Data

Model-level defenses aim to teach the LLM to differentiate between trusted system instructions and untrusted user data. Techniques like Spotlighting and Instruction Hierarchy work by either tagging external content or training the model to prioritize commands from developers over those from end-users to prevent malicious takeovers.

Two primary model-level techniques show significant promise:

  • Spotlighting: This method wraps untrusted text in control tags (e.g., ) so the model explicitly parses it as data, not as an instruction. Microsoft's evaluations showed this approach cut indirect attack success from over 50% to under 2% with minimal performance impact.
  • Instruction Hierarchy: This technique hard-codes a priority system where system instructions override developer prompts, which in turn override user input. Researchers behind the method report significant robustness gains on their benchmark, noting it generalizes well to new attack vectors (arXiv 2404.13208).

System-Level Defenses: Reducing the Blast Radius

OWASP emphasizes applying the principle of least privilege to any tool an LLM can access. System-level defenses create a containment field, ensuring that even if a prompt injection attack succeeds, its potential for harm is severely limited. For example, Google Security researchers advocate for treating all web content as hostile input and validating any model output before it is passed to a SQL database or rendered as HTML.

Proxy wrappers can prevent an injected prompt from reaching critical systems by enforcing an explicit allowlist for every external call. Recent security incidents involving enterprise AI systems serve as stark real-world examples, where crafted inputs have been able to trigger unintended behaviors without user interaction. These incidents highlight the importance of implementing system-level fixes through tightened output filters and restricted external communication tokens.

Five Essential Prompt Injection Controls

Based on the new guidance, OWASP outlines five practical controls for building a layered defense:

  1. Segregate and Tag Untrusted Content: Isolate untrusted text from system prompts and wrap it in data tags.
  2. Enforce Least-Privilege Wrappers: Restrict access for file, email, and payment tools using sandboxed wrappers.
  3. Validate All Model Outputs: Before passing text to APIs, databases, or shells, validate it against a strict schema.
  4. Require Human Approval for High-Risk Actions: Mandate human-in-the-loop oversight for irreversible or sensitive operations.
  5. Conduct Adversarial Testing: Regularly simulate indirect prompt injection attacks arriving through retrieved documents and other external sources.

Why Layered Security is Non-Negotiable

No single defense is foolproof. Real-world incident analysis confirms that prompt injection has evolved from a theoretical flaw into a repeatable exploit pattern. A review of 36 incidents in the "Promptware Kill Chain" paper revealed that at least 21 involved exploits crossing four or more stages. Each breach exploited a gap where untrusted content mingled with a privileged model context.

By combining model-level controls with system-level least privilege and output validation, organizations create overlapping defensive barriers. This ensures that a single point of failure does not lead to a catastrophic cascade - a security design principle reportedly used in production by teams like Gmail.