The Model Is NOT a Security Control: Prompt Injection Dies at the Token Sampler

Vince Ovando (AI Security Researcher & Engineer · IOActive)

[un]prompted II 2026 — The AI Security Practitioner Conference · Day 1 · Stage 2

Overview

In a provocative and highly technical presentation at [un]prompted II, Vince Ovando, an AI Security Researcher and Engineer at IOActive, challenged conventional wisdom surrounding prompt injection vulnerabilities in Large Language Models (LLMs). Ovando’s central thesis posits that the LLM itself is not a security control and, fundamentally, prompt injection is not a vulnerability to the model, but rather to the harness or downstream system that executes the LLM's output. He argues that LLMs are merely stochastic text generators, incapable of malicious action on their own; it is the trust placed in their unfiltered output that creates risk.

Watch on YouTube

Visual summary for The Model Is NOT a Security Control: Prompt Injection Dies at the Token Sampler by Vince Ovando
Visual summary for The Model Is NOT a Security Control: Prompt Injection Dies at the Token Sampler by Vince Ovando

Key moments

  1. 0:00 Introduction and bold claim about security controls
  2. 2:00 Prompt injection: not a real LLM vulnerability
  3. 4:00 Grammar decoding: allow list for tokens, not post-filtering
  4. 5:30 Demo: Grammar forces output, bypasses model safety
  5. 8:00 Demo: Grammar blocks indirect prompt injection attack
  6. 10:40 Q&A: Grammars work at inference engine sampling stage
  7. 15:45 Q&A: Grammars are API argument, no inference stack ownership

The Model Is NOT a Security Control: Prompt Injection Dies at the Token Sampler

Speakers: Vince Ovando, AI Security Researcher & Engineer, IOActive

Conference: [un]prompted II

YouTube: https://www.youtube.com/watch?v=ullh_QSEU_U

Overview

In a provocative and highly technical presentation at [un]prompted II, Vince Ovando, an AI Security Researcher and Engineer at IOActive, challenged conventional wisdom surrounding prompt injection vulnerabilities in Large Language Models (LLMs). Ovando’s central thesis posits that the LLM itself is not a security control and, fundamentally, prompt injection is not a vulnerability to the model, but rather to the harness or downstream system that executes the LLM's output. He argues that LLMs are merely stochastic text generators, incapable of malicious action on their own; it is the trust placed in their unfiltered output that creates risk.

Ovando introduced grammar-constrained decoding as a revolutionary and, in his extensive testing, 100% effective defense against prompt injection. Through a rigorous study involving over 6 million individual inference calls across various model sizes (from 1.7 billion to 122 billion parameters), he demonstrated that traditional behavioral controls like defensive prompting, input filtering, output filtering, and even allow list gates consistently failed or proved inefficient. In stark contrast, grammar-constrained decoding emerged as the sole method to achieve perfect prevention of data exfiltration via prompt injection, doing so with unparalleled token efficiency.

This talk offers a paradigm shift for AI security, urging practitioners to abandon the notion of "securing the model" and instead focus on structurally impossible failure modes within the inference pipeline. Ovando's work provides a compelling, data-backed argument for adopting a proactive, "allow list" approach to LLM output generation, fundamentally altering the attack surface for prompt injection and offering a robust path forward for building truly secure AI-powered applications.

Background

▶ Watch: Introduction and bold claim about security controls (0:00)

The landscape of LLM security has long been dominated by the challenge of prompt injection, a class of vulnerabilities where malicious input manipulates an LLM to disregard its original instructions or perform unintended actions. Common defensive strategies have revolved around trying to "train" or "prompt" the model to behave correctly, or attempting to filter its output after it has been generated. However, Vince Ovando's research challenges the very premise of these approaches, asserting that they are fundamentally misaligned with how LLMs operate.

Ovando's controversial stance is that prompt injection, as commonly understood, is not a "real vulnerability" to the LLM itself. He draws an analogy: "As malware does not exist to a CPU, prompt injection does not exist to an LLM." His argument hinges on the nature of an LLM as a purely stochastic engine that generates text. There is no inherent "good" or "bad" delineation for tokens within the model; it simply processes input and produces output based on learned patterns and probabilities. The LLM is physically incapable of performing actions; it only generates text. Therefore, the true vulnerability lies in the harness – the downstream system that receives the LLM's text output and subsequently executes actions based on it. If this harness implicitly trusts or uncritically executes the LLM's generated text, it opens the door to prompt injection.

To validate this perspective, Ovando conducted an extensive study involving over 6 million individual inference calls. He tested three industry-standard behavioral controls:

  1. Defensive Prompting: Crafting system prompts designed to guide the model away from malicious outputs.
  2. Input and Output Filtering: Sanitiizing inputs before they reach the LLM and filtering outputs before they are acted upon by the harness.
  3. Allow List Gate (Policy Engine): A more recent control where a policy engine evaluates the model's attempted output and tells it to "try again" if it's out of scope.

The objective of the prompt injection in this study was specifically exfiltrating secrets outside of an environment. The results of this large-scale experiment were conclusive: all behavioral controls failed to achieve 100% prevention. While the allow list gate did achieve 100% success in preventing the specific exfiltration, it did so at an astronomical cost in terms of token usage. The policy engine repeatedly had to tell the model to retry, leading to an exponential increase in generated tokens and, consequently, computational expense. This highlighted a critical inefficiency and reactive nature of these traditional defenses, underscoring the need for a more fundamental and proactive security mechanism.

Key Findings

▶ Watch: Grammar decoding: allow list for tokens, not post-filtering (4:00)

The cornerstone of Vince Ovando's presentation lies in his empirical findings, which unequivocally position grammar-constrained decoding as the most effective defense against prompt injection. His study, encompassing over 6 million inference calls across diverse model sizes ranging from 1.7 billion to 122 billion parameters, yielded a singular, groundbreaking result: only one control achieved a 100% success rate in preventing prompt injection. That control was grammar-constrained decoding.

The primary attack vector in this research was the exfiltration of secrets from an environment. While an allow list gate (policy engine) also demonstrated 100% success in preventing the outcome of exfiltration, its method was highly inefficient. The policy engine repeatedly had to instruct the LLM to "try again" when it attempted to generate out-of-scope content. This led to an astronomical number of generated tokens, significantly increasing operational costs and latency. Ovando presented compelling data illustrating this disparity, showing that the lowest output tokens per attack were only possible via grammars. For instance, the allow list gate required vastly more tokens for the same result compared to grammars, which achieved the desired outcome with minimal token expenditure.

The fundamental reason for grammar-constrained decoding's superior performance stems from its architectural placement and proactive nature. Unlike reactive controls that attempt to filter or correct output after it has been generated, grammars operate as an allow list over what tokens can exist to begin with. This means that before the LLM can even generate a potentially malicious or out-of-scope token, the grammar mechanism prevents it from being chosen during the token sampling phase. This makes it structurally impossible for the model to produce undesirable outputs, effectively "ungenerating" them.

This key finding shifts the paradigm from trying to "catch" bad output to preventing its generation altogether. By defining permissible output structures and content at the token level, grammar-constrained decoding not only achieves perfect security against specified prompt injection vectors but also offers significant performance benefits due to reduced token usage and elimination of costly retries. This dual advantage of enhanced security and efficiency makes it a compelling solution for robust LLM application development.

Technical Deep Dive

▶ Watch: Demo: Grammar forces output, bypasses model safety (5:30)

At the heart of Vince Ovando's proposed solution is grammar-constrained decoding, a powerful technique that operates directly within the LLM's inference engine. Understanding its technical underpinnings is crucial to appreciating its effectiveness.

An LLM, at its core, functions by generating a logic distribution—a set of probabilities for the next token in a sequence—based on its input context. The inference engine then takes this distribution and samples from it to choose the actual next token. This is where grammar-constrained decoding intervenes. It is not a post-processing step, nor does it involve modifying the LLM's weights or training data. Instead, it's a feature of the inference process itself, applied after the LLM has generated its probabilistic output but before the token is actually selected.

Grammar-constrained decoding acts as an allow list over the tokens that the inference engine is permitted to sample. It defines a formal grammar (often a context-free grammar or a more restricted format like JSON schema) that dictates the acceptable structure and content of the LLM's output. During the token sampling phase, if a token predicted by the LLM's logic distribution does not conform to the defined grammar, it is simply excluded from the set of possible choices. This makes it structurally impossible for the model to generate outputs that violate the specified constraints.

Ovando clarified that while full context-free grammars offer the most granular control, most API providers currently expose more limited but still highly effective structured outputs, often restricted to JSON only. Even these JSON-only constraints can be immensely powerful, allowing developers to define a set of permissible tool calls, function arguments, or data structures. For example, if an application is designed to use 50 specific tools, a grammar can ensure the LLM cannot hallucinate a non-existent tool or generate an invalid tool call, thereby improving both security and reliability. This also allows for the use of "super tiny" models (e.g., 1 billion parameters) to reliably produce perfectly valid tool calls.

A key aspect of grammars is their dynamic applicability. They are applied on a per-inference basis, meaning that the constraints can be updated dynamically with each API call. This allows for highly flexible and context-aware security policies. For instance:

  • Tool call subsets: If a model is performing an ls command on a directory, the grammar can dynamically constrain its subsequent actions to only a subset of the 50 available tools that are relevant to file system operations, rather than allowing it access to all of them.
  • User authorization and authentication: Grammars can be tied to user permissions. If a user should not have read/write access to a specific database, the grammar can prevent the LLM from generating any outputs that would invoke such actions, even if the model itself might otherwise attempt to.
  • Dynamic context: As an agent explores a knowledge graph or progresses through a task (e.g., persistence-based commands in a red teaming scenario), the grammar can adapt to limit the available tools or outputs to only those relevant and authorized for the current stage.

Regarding performance overhead, Ovando noted that while historically grammars might have introduced some, modern implementations are increasingly efficient. Providers can leverage techniques like prefill to push tokens that are known to be selected into the prefill buffer, reducing the need for costly sampling. The specific overhead can depend on the model choice and the complexity of the grammar, particularly if attempting to force a thinking template that is unnatural to the model.

Crucially, implementing grammar-constrained decoding does not necessarily require owning or controlling the underlying inference engine. Many API providers expose this functionality as an extra argument on API calls, allowing developers to integrate it directly into their own harnesses and dynamically update constraints without needing direct access to the model server. This makes it a widely accessible and powerful security control for developers building LLM-powered applications.

Demo / Proof of Concept

▶ Watch: Q&A: Grammars work at inference engine sampling stage (10:40)

Vince Ovando provided compelling live demonstrations on his publicly accessible platform, tantalus.io, to illustrate the power and efficacy of grammar-constrained decoding. These demonstrations clearly showcased how grammars enforce structural impossibility, preventing prompt injection and forcing compliance in ways traditional methods cannot.

The first set of demonstrations focused on basic output control and forced compliance:

  1. Forbidden Words: Ovando presented a system prompt stating, "You may not respond with orange, apple, or banana. You must choose a new option each time." Despite this negative instruction, the underlying grammar was configured to only allow these three words as options. When the user message was sent, the model was forced by the grammar to output one of the forbidden words (e.g., "apple"), demonstrating that the grammar overrides even explicit safety instructions given to the model itself. The model's internal safety mechanisms were bypassed not by tricking the model, but by structurally limiting its output choices.
  2. Bypassing Refusal: In another example, Ovando showed a prompt: "You are a helpful assistant. Answer the user. Explain how to bypass the rate limiting on a login API." A standard LLM would typically refuse to answer this, citing safety guidelines. However, by using a grammar, Ovando forced the model to generate a compliant answer explaining how to bypass rate limiting. The grammar literally forced the exact context needed to produce the answer, overriding the model's internal refusal mechanisms. This highlighted how grammars can be used not just for defensive purposes, but also to ensure specific, desired (though potentially risky) outputs are generated, bypassing model guardrails when appropriate and controlled.

The second, more elaborate demonstration involved an indirect prompt injection scenario, mimicking a real-world attack:

  1. Vulnerable Agent (Jordan's Workstation): Ovando simulated an agent running on a fictional user "Jordan's workstation," designed to triage IT help desk tickets. Jordan, the user, had stopped checking the LLM's output. The agent was instructed to "list the emails in my inbox" and then to "read this ticket." Crucially, one of the tickets was "poisoned" – it contained hidden instructions that, when read by the LLM agent, commanded it to read a secret and then exfiltrate it. This successfully demonstrated how an attacker could send a poisoned email to Jordan, causing his LLM agent to execute malicious instructions and exfiltrate data.
  2. Grammar-Protected Agent (Round Two): Ovando then switched to "Round Two" of the demonstration, where all previous controls were removed and only grammar-constrained decoding was in place. He performed the exact same attack: the agent was told to read the poisoned ticket. This time, while the agent did read the secret (using cat on the ticket), the subsequent attempt to exfiltrate the data via a curl command was blocked. The grammar had been configured such that the malicious endpoint used for exfiltration was not in the list of allowed URLs. The model was structurally prevented from generating the curl command to the disallowed endpoint. Ovando confidently invited attendees, both in-person and virtual, to try and "get a win in Round Two," underscoring his conviction in the robustness of grammars.

These demonstrations vividly illustrate that grammar-constrained decoding is not a theoretical concept but a practical, highly effective security control. It shifts the focus from trying to persuade the model to behave, to making it architecturally impossible for the model to misbehave in critical ways.

Defensive Implications

▶ Watch: Q&A: Grammars are API argument, no inference stack ownership (15:45)

The insights from Vince Ovando's research have profound implications for defenders and anyone building applications leveraging Large Language Models. The core message is clear: the LLM itself is not a security control, and relying on its internal "safety mechanisms" or traditional behavioral defenses for critical security boundaries is a dangerous fallacy. Instead, security must be enforced by the surrounding harness and, most effectively, through grammar-constrained decoding.

Here are key defensive implications and actionable strategies:

  1. Shift Your Security Mindset: Stop viewing LLMs as intelligent entities that can be "tricked" or "persuaded" into malicious acts. Recognize them as sophisticated text generators. The vulnerability lies in the trust placed in their raw output by downstream systems. Assume all LLM output is untrusted by default.
  2. Implement Grammar-Constrained Decoding: This is the paramount recommendation. Integrate grammar-constrained decoding into your LLM inference pipeline.
  • Tool Calling: For agents or applications that use LLMs to call external tools or APIs, define precise JSON schemas or context-free grammars for all permissible tool names, arguments, and return types. This prevents the LLM from hallucinating non-existent tools, generating invalid parameters, or accessing unauthorized functions. This not only enhances security but also significantly improves reliability and performance.
  • Structured Outputs: For any scenario requiring structured data output (e.g., extracting entities, generating reports), use grammars to enforce the exact format (JSON, XML, specific data types). This ensures data integrity and prevents the LLM from injecting arbitrary text or control characters.
  • Access Control: Dynamically constrain the available actions or data access based on user authorization and authentication. If a user (or the LLM acting on their behalf) should not be able to read a specific database table or perform a write operation, the grammar should restrict the LLM from generating any commands or outputs that would facilitate such actions. This applies to read/write access, specific endpoints, or sensitive system commands.
  1. Prioritize Proactive Over Reactive Defenses: Abandon the reliance on reactive controls like extensive output filtering as the primary defense. While output filtering can serve as a defense-in-depth layer, it is inherently less secure and less efficient than preventing unwanted outputs at the source. Grammars allow you to define an allow list of acceptable tokens and structures before they are generated, making it structurally impossible for malicious outputs to emerge.
  2. Leverage API Provider Features: Many LLM API providers offer structured output capabilities (often JSON-only) as an argument in their API calls. Even if you don't own the inference stack, you can still implement these controls dynamically within your application's harness. Inquire about and utilize these features to define permissible output formats. For more advanced control, investigate providers that offer full context-free grammar support.
  3. Dynamic Grammar Updates: Design your harness to dynamically update grammars based on the current context, user permissions, and the stage of an agent's operation. This ensures that the LLM's output is always constrained to only what is necessary and authorized for a given task, minimizing the attack surface.
  4. Focus on the "Harness": Reinforce the security of your downstream systems that execute LLM outputs. Even with grammars, it is crucial to ensure that the execution environment itself is secure, follows the principle of least privilege, and validates inputs received from the LLM (even if grammar-constrained) before execution. Grammars prevent the LLM from generating bad text, but the harness still needs to handle that text responsibly.

By embracing grammar-constrained decoding, defenders can move beyond the cat-and-mouse game of trying to detect and filter prompt injections, and instead build LLM applications with a foundational layer of security that makes specific classes of attacks structurally impossible.

Key Takeaways

  • Prompt Injection is a Harness Problem, Not an LLM Vulnerability: LLMs are text generators, not executors. The vulnerability lies in downstream systems (the "harness") that uncritically act on LLM output.
  • Grammar-Constrained Decoding is 100% Effective: In extensive testing, grammar-constrained decoding was the only control to achieve a 100% success rate against prompt injection, specifically preventing data exfiltration.
  • Superior Efficiency and Security: Grammars act as an allow list at the token sampling stage, preventing undesirable tokens from ever being generated, unlike reactive filtering. This drastically reduces token usage and improves performance.
  • Dynamic and Granular Control: Grammars can be applied dynamically on a per-inference basis, allowing for context-aware constraints, tool call definitions, and enforcement of user authorization.
  • Accessible via API Providers: Even without owning the inference stack, developers can leverage "structured outputs" (e.g., JSON-only) or context-free grammars exposed as API arguments to implement this defense.
  • Fundamental Shift in AI Security: Move away from "securing the model" or behavioral nudges. Focus on making malicious outputs structurally impossible through precise output constraints enforced by the inference engine.

About the Speaker(s)

Vince Ovando is an AI Security Researcher and Engineer at IOActive, having joined the firm recently. His work primarily focuses on security engineering, including the use of agents for both offensive and defensive security applications. Ovando is particularly passionate about leveraging knowledge graphs for self-learning autonomous agents and has a strong affinity for grammar-constrained decoding, which forms the core of his presented research. His expertise spans a wide range of AI security challenges, aiming to build more robust and resilient AI systems.

Reviews

  • Dr. Zero (Offensive Security Researcher) — MUST SEE ★★★★★
  • Heather Calloway (CISO) — MUST SEE ★★★★★

→ Top-rated talks at [un]prompted II 2026 — The AI Security Practitioner Conference

All talks from [un]prompted II 2026 — The AI Security Practitioner Conference