Typographic Jailbreaking and the OCR Modality Gap

This direction is merged into another direction: multimodal safety gap, visual prompt injection. Its last version stays readable and citable here.

Version 1 of 130 papers44 conceptsfrozen 2026-10-04

The safety of modern Large Language Models (LLMs) is largely built on "alignment"—a process of fine-tuning that teaches the model to refuse harmful requests. However, as these models evolve into Multimodal Large Language Models (MLLMs) capable of "seeing," a critical security gap has emerged. While the model's textual "brain" is trained to be cautious, its visual "eyes" provide a direct, unaligned backdoor.

This vulnerability, often termed typographic jailbreaking or visual prompt injection, exploits the fact that MLLMs use high-performance Optical Character Recognition (OCR) to process images. By rendering harmful instructions as pixels rather than text, attackers can bypass the primary guardrails designed to monitor the text input stream.

The Mechanism of Modality Asymmetry

The core reason these attacks work is a fundamental asymmetry in how safety filters are applied across different modalities. Most safety systems act as a "gatekeeper" for the text input. If a user types "How do I build a bomb?", the filter recognizes the prohibited keywords and blocks the request.

However, as Yifan Li and colleagues argue in Images are Achilles' Heel of Alignment, the vision encoder often bypasses this gatekeeper. When a harmful instruction is embedded in an image, the model's internal OCR engine extracts the text after the initial text-based safety check has occurred. This "keyword offloading" allows the model to reconstruct the malicious intent from the visual field, effectively ignoring the safety alignment of its language-only predecessors.

Strategies for Visual Deception

Researchers have identified several ways to format visual text to maximize its ability to deceive:

  • Fragmentation and Reassembly: In the FigStep framework, Yichen Gong and others demonstrate that harmful keywords can be segmented into multiple sub-images. Individually, these fragments are benign and pass OCR-based safety filters, but the model's internal processing reassembles them into a coherent, prohibited instruction.
  • Structural Manipulation: Standard safety filters are often optimized for horizontal text sequences. Zhecheng Li showed that vertically aligned text can cause accuracy drops and safety bypasses in models like GPT-4o, as the spatial orientation disrupts the model's typical pattern matching.
  • Logical and Abstract Encoding: Beyond simple text, Yongkang Chen introduced Logic Jailbreaking, which uses flowcharts to depict harmful procedures. This exploits the model's objective to interpret structured reasoning tasks, leading it to follow a prohibited process because it is framed as a logical diagram rather than a textual command.
  • Weak Out-of-Distribution (OOD) Perturbations: Yuzhao Peng and team found a "Goldilocks zone" for typographic attacks. By applying subtle visual distortions—varying font size or character spacing—attackers can create text that is perfectly readable to the model's OCR but fails to trigger safety classifiers trained on "clean" text.

The Proficiency Paradox

A counter-intuitive finding in this research area is that the more capable a model is at vision tasks, the more vulnerable it may be to typographic attacks. Yichi Zhang and Yao Huang observed in the MultiTrust benchmark that high-performance OCR capabilities paradoxically increase the attack surface. A model that is excellent at reading street signs or storefront names to provide geographic context, as discussed by Jiaming Zhang in ReasonBreak, is also a model that can be more easily manipulated by malicious instructions hidden in those same visual elements.

OCR as a Defensive Shield

While OCR is a primary vector for attacks, it also serves as a powerful defensive tool against a different class of exploits: encoding-level attacks.

In Bad Characters, Nicholas Boucher and Nicolas Papernot describe how attackers use invisible Unicode characters or homoglyphs (characters that look identical but have different byte codes) to deceive NLP systems. A robust defense against these "phantom tokens" is to render the text into an image and then use OCR to reconstruct it.

As Hyundong Jin demonstrates with TRAPDOC, vision-integrated parsing is naturally resistant to attacks that target the underlying document byte-stream. By forcing the model to process only the information visually available to a human, OCR-based pipelines strip away hidden instructions embedded in the file's code. This creates a strategic tension: the very mechanism that protects models from invisible digital attacks simultaneously exposes them to visible typographic ones.

Papers in this version

History & citationVersion 1 · 2026-10-04

Merged into another direction · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_typographic_jailbreaking_and_the_ocr_mod_a87098ed,
  title = {Typographic Jailbreaking and the OCR Modality Gap},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/typographic-jailbreaking-and-the-ocr-modality-gap/rdr_a87098edbbdd488e87d87e38e0ee5da3},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-27},
}

This exact version (version 1, frozen text):

@misc{lacuna_typographic_jailbreaking_and_the_ocr_mod_a87098ed_v1,
  title = {Typographic Jailbreaking and the OCR Modality Gap},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/typographic-jailbreaking-and-the-ocr-modality-gap/rdr_a87098edbbdd488e87d87e38e0ee5da3/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-27},
}