English
Fonts are programs: a security history of rendering engines
Text rendering is one of the few places where untrusted data gets processed automatically: receive a notification, open a web page or preview an attachment, and the system parses the text and fonts inside it. And font formats hide several virtual machines.
Virtual machines inside fonts
| Mechanism | Purpose | Nature |
|---|---|---|
| TrueType hinting | Snap outlines to the pixel grid at small sizes | Bytecode VM with a stack, functions, loops and storage |
| CFF / Type 2 CharString | Describe glyph outlines | Stack-based drawing program |
| OpenType GSUB / GPOS | Glyph substitution and positioning | Rule engine that rewrites glyphs based on context |
| HarfBuzz WASM shaper | Let a font carry its own shaping logic | Experimental, runs arbitrary WASM, off by default |
In other words, loading a font means running a program, and the code that parses these formats is mostly large parsers and interpreters written in C / C++ and heavily optimized for speed.
Know which layer you are talking about
When "a string crashes the system" or "a font is used in an attack", which layer is at fault?
| Layer | Responsible for | Examples |
|---|---|---|
| Unicode Standard | Characters, properties, algorithms | UAX #9, #15, #29 |
| String libraries | Encoding conversion, normalization, case mapping | ICU, CFString |
| Shaping / layout | Characters → glyphs, layout, line breaking, truncation | CoreText, HarfBuzz, Uniscribe, DirectWrite |
| Font parsing and rasterization | Parse font files, run hinting / CharStrings | FontParser, FreeType, ATMFD |
The Unicode Standard is a specification and cannot have memory bugs; the problem is always in some layer's implementation. But the complexity of Unicode decides how many kinds of valid input a layout engine has to handle, and the font format decides how much executable logic an attacker can pack in.
The standard is aware of this and sets some limits: UAX #9 caps bidi nesting at 125 levels; UAX #15 defines the Stream-Safe Text Format: after NFKD decomposition, there are no more than 30 consecutive non-starters (characters whose canonical combining class is not 0). This is an extra format restriction that ordinary valid Unicode strings, even NFC / NFD strings, may exceed; only after converting the input to Stream-Safe format (inserting U+034F CGJ into overlong sequences) can an implementation normalize with a fixed-size buffer.
Crash strings: bugs in the layout layer
- 2015 "effective power": a message mixing Arabic with other scripts. When iOS truncated it and added an ellipsis in the notification banner, CoreText failed and SpringBoard crashed.
- 2018 Telugu
జ్ఞా: a conjunct + ZWNJ + vowel sign combination that made CoreText fail. - black dot: a message that spread on WhatsApp for Android in 2018, containing thousands of invisible bidi control characters (U+200E LRM / U+200F RLM). Layout got stuck in heavy computation, a CPU-bound DoS.
What they have in common: the input is valid Unicode, but the shaping rules for Indic and Arabic scripts, combined with ZWJ / ZWNJ, combining marks and bidi, create a huge combinatorial space, and rarely tested code paths in shaping engines break as soon as they are hit. These bugs mostly stop at DoS (out-of-bounds reads, null derefs, aborts).
Windows: font parsing used to run in the kernel
For performance, NT 4.0 (1996) moved GDI into the kernel (win32k.sys). For a long time after that:
- TrueType fonts were parsed by
win32k.sys; - Type 1 / OpenType-CFF fonts were parsed by
ATMFD.DLL, written by Adobe; - both ran in ring 0, including the hinting and CharString interpreters.
Anything that could make the system load a font, such as web fonts, Office documents or PDFs, led straight into the kernel. A restricted sandbox process could reach the kernel just by calling GDI, which made font bugs particularly good for sandbox escapes.
| Incident | Details |
|---|---|
| Duqu (2011) CVE-2011-3402 | A TrueType font embedded in a Word document broke win32k.sys while it was being parsed (MS11-087); the 0-day went straight to kernel privileges. |
| j00ru, "One font vulnerability to rule them all" (2015) | Project Zero research showed that Adobe's CharString engine lived in Adobe Reader (CoolType), Windows ATMFD.DLL, DirectWrite and WPF: the same bug (the BLEND operator, CVE-2015-0093 for Windows and CVE-2015-3052 for Adobe) gave RCE in Reader and privilege escalation in the Windows kernel. |
| Hacking Team leak (2015) | The leaked data contained two ATMFD.DLL 0-days: CVE-2015-2387 (MS15-077) and CVE-2015-2426 (MS15-078). CVE-2015-2387 was paired with a leaked Flash bug to escape the browser sandbox. |
| ADV200006 (2020) | An Adobe Type Manager Library 0-day exploited in the wild (later patched as CVE-2020-0938 / CVE-2020-1020). On Win7 the code still ran in the kernel and gave system privileges; from Win10 1703 fonts are parsed in an AppContainer inside fontdrvhost.exe, so the impact was much smaller, and from 1709 ATMFD.DLL is no longer included. |
Mitigations that followed:
- Win32k lockdown: Chrome forbids renderer processes from making win32k syscalls and uses DirectWrite, which runs in user mode inside the renderer; the browser process only proxies system font enumeration and access to font files (DirectWrite Font Proxy).
- Untrusted Font Blocking (Windows 10): can block fonts loaded from outside the system font directory.
- Font Driver Host: font parsing moved out of the kernel into
fontdrvhost.exe, which runs in user mode in an AppContainer sandbox. - Removing ATMFD: from Windows 10 1709 the Adobe font driver is gone from the kernel entirely.
Browsers: font libraries as an RCE entry point
CVE-2020-15999: Chrome parsed web fonts with FreeType, and a 16-bit integer truncation while handling PNG bitmap glyphs (Load_SBit_Png) caused a heap overflow that was exploited in the wild as a 0-day. It was the renderer RCE link of the chain, followed by a Windows kernel cng.sys bug (CVE-2020-17087) to escape the sandbox (see the Project Zero analysis).
The mitigation is to rewrite in a memory-safe language: Chrome switched to Fontations / Skrifa, written in Rust, and removed FreeType from Blink in Chrome 145 (Chrome's announcement).
iMessage 0-click: mostly not about Unicode
| Incident | Entry point | Layer |
|---|---|---|
| Project Zero research (2019) (CVE-2019-8641 and others) | NSKeyedUnarchiver deserialization | Object deserialization |
| FORCEDENTRY (2021) CVE-2021-30860 | A PDF disguised as a GIF, integer overflow in the JBIG2 decoder | Image / PDF codec |
| BLASTPASS (2023) CVE-2023-41064 / CVE-2023-41061 | PassKit attachment and WebP decoding in ImageIO (libwebp, see the Project Zero analysis) | Attachment validation + image codec |
| Operation Triangulation (2023) CVE-2023-41990 | A font in an attachment, Apple's old undocumented TrueType ADJUST instruction | Font parsing |
Exploitable 0-clicks usually go through formats where the attacker controls more structure: images, PDFs, fonts, serialized objects. Plain text gives too little control and tends to stop at DoS. Apple's answer was BlastDoor (iOS 14), which moved parsing of most untrusted iMessage content into a tightly isolated service. But not every attachment codec moved with it: FORCEDENTRY's image conversion happened in IMTranscoderAgent, outside BlastDoor, a process with its own sandbox.
Bonus: Conway's Game of Life in a font
Since GSUB is a rule engine that "looks at context and rewrites glyphs", it can implement a cellular automaton. The community has built similar things: Fontemon, a whole game written into a font, and llama.ttf, which packs a small LLM into a font using the HarfBuzz WASM shaper. The design:
- Input: shaping works on text runs with uniform properties (HarfBuzz docs), so flatten the W×H board into a single line of characters in one run (
.dead,#alive), with a separator character between rows. - Reading neighbors: use the backtrack / lookahead of chaining contextual substitution. Left and right neighbors are one position away; neighbors above and below are W+1 positions away, padded with an "any cell" class.
- Double buffering: a lookup is applied left to right, so cells further along see glyphs that were already replaced. First replace each cell with a glyph that carries both "old state + new state" and match only on the old state; a second lookup then drops the old state.
- Generations: in the spec a contextual lookup can call itself recursively, and Litherum (2019) argued from this that font shaping is Turing complete in an abstract model with unlimited resources. But HarfBuzz and other implementations limit lookup nesting depth and total work, so recursion cannot run forever; each generation has to be unrolled as its own lookup in the font, and features such as
ss01–ss20pick how many generations to run. In practice everything is bounded. - Output: each row uses a set of glyph variants drawn at a different height, and the row separator has a negative advance width that pulls x back to the start of the line, so a 2D board is drawn within "one line of text"; add COLRv1 and you get color.
The point of this bonus is the same as the whole page: a shaping engine is a machine that takes the font as its program and Unicode text as its input.
Verification scope (2026-11-12)
CVE numbers, incident years and the main technical details on this page were checked against original reports from Project Zero, Citizen Lab, Kaspersky, Microsoft bulletins and others; the Game of Life bonus is a design sketch and has not been implemented.