Render Before Reading: Visual Rendering as a Prompt Injection Defense

Jie Zhang, Andrei Baroian, Jan N. van Rijn, Avital Shafran, Florian TramèrarXiv 2026

TL;DR

Multimodal Large Language Models (LLMs) exhibit a striking "modality gap": they are significantly more likely to follow instructions delivered as text than those embedded in images, even when they can read the images perfectly. The authors exploit this asymmetry with Pictionary, a training-free defense that renders untrusted text into typographic images, slashing prompt injection success rates by up to 300x while preserving the model's ability to reason over the content.

What Problem Does This Paper Address?

Prompt injection is the "Achilles' heel" of LLM-based agents. Whether it’s a malicious instruction hidden in a web page (indirect injection) or a "jailbreak" attempt in a user-uploaded document (direct injection), these attacks hijack the model's behavior, forcing it to leak data or perform unauthorized actions.

Existing defenses, like using delimiters or "sandwiching" instructions, are often brittle because LLMs don't have a fixed grammar for authority. This paper identifies a deeper, structural vulnerability: because models are primarily instruction-tuned on text, they develop a strong prior that text = commands to obey, whereas images = content to describe. The authors set out to turn this text-centric bias into a robust security feature.

Methods

The researchers propose a defense called Pictionary. The core idea is elegantly simple: render before reading.

Instead of passing untrusted third-party text (like a tool output or a document) directly to the model as a string, the system first renders that text into a simple typographic image (black text on a white background).

Figure 1: Image-rendering defense against prompt injection. When untrusted content reaches the model, either through a user-uploaded document or a third-party tool output, the default text pipeline exposes the model to prompt injections embedded in that content. Our defense renders the untrusted content as an image before passing it to the model, substantially reducing the attack success rate.

This creates a "channel-level instruction hierarchy." Trusted instructions (the system prompt and user query) remain as text and retain their full authority. Untrusted data arrives via the image channel—a modality the model is capable of reading via OCR but is not conditioned to obey. The authors also demonstrate that this principle generalizes to audio by using text-to-speech (TTS) for untrusted payloads.

Datasets

The study evaluates Pictionary across ten different Vision-Language Models (VLMs) using several rigorous benchmarks:

  • DirectInject: A benchmark for direct prompt injection via user-supplied documents.
  • AgentDojo: A framework for evaluating indirect injections in multi-turn, tool-using agent scenarios (e.g., banking, Slack, travel).
  • $\tau^2$-Bench & SWE-bench Verified: Used to "stress-test" utility, ensuring the defense doesn't break complex agentic tasks like customer service or software engineering.
  • RLVR-IFEval: Used for a controlled fine-tuning experiment to investigate the origins of the modality gap.

Key Insights and Ideas

  • The Modality Gap is Real: In conflict tests where a model receives two contradictory instructions—one in text and one in an image—models overwhelmingly favor the text instruction. For some models, the preference for text is 300x stronger.
Figure 2: Instruction-following across six VLMs (mean ± std over 5 runs). (a) In isolation, each modality is followed at near-ceiling rates. (b) Under conflict, text compliance dominates on every model; the remainder are responses that follow neither instruction. Results reveal a systematic preference for the textual channel rather than an inability to act on image-supplied instructions.
  • Reading $\neq$ Obeying: The defense works not because the model can't read the attack, but because it chooses not to follow it. The model's OCR capabilities remain high, allowing it to extract information for benign tasks while ignoring the imperative nature of the rendered text.
  • Instruction Tuning is the Source: The authors found that base models (pre-instruction tuning) don't show this gap. The bias is a side-effect of modern training regimes that use text-only instruction-response pairs.
  • Vulnerability is Teachable: By fine-tuning models on benign image-rendered instructions, the researchers were able to "erode" the defense, proving that the gap is a consequence of the training distribution rather than an inherent property of the vision modality.

Key Results

Pictionary consistently reduced Attack Success Rates (ASR) across all models and benchmarks:

  • GPT-4o mini: On DirectInject, ASR dropped from 75.0% to 0.0% under static attacks. Even against a union of adaptive attacks (RL-optimized and human red teaming), ASR fell from 100% to 17.8%.
  • Claude 3.5 Haiku: Under the strongest adaptive attacks on AgentDojo, ASR was slashed from 97.6% to 9.5%.
  • Utility Preservation: On the $\tau^2$-Bench customer service task, success rates remained within 2.1 percentage points of the undefended text baseline, proving the defense is viable for real-world agents.

Limitations and Future Work

  • OCR Dependence: The defense relies on the model's ability to accurately OCR the rendered text. For tasks requiring character-perfect precision (like code editing in SWE-bench), utility can drop by ~10% if the model makes minor transcription errors.
  • Serving Cost: Passing images to an API is currently more expensive than passing text. However, the authors note that emerging "optical context compression" techniques could eventually make image-based serving cheaper than text.
  • Native Visual Attacks: Pictionary only protects against text that is converted to images. It offers no protection against attacks that are natively visual, such as malicious instructions already embedded in a screenshot or a scanned PDF.
  • Future Direction: The authors suggest that layering Pictionary on top of existing text-based defenses could provide a powerful multi-layered security posture.

Summary updated

BibTeX
@misc{zhang2026render,
  author = {Jie Zhang and Andrei Baroian and Jan N. van Rijn and Avital Shafran and Florian Tramèr},
  title = {{Render Before Reading: Visual Rendering as a Prompt Injection Defense}},
  year = {2026},
  eprint = {2609.36121},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.36121},
}
Figure