Skip to content
Memory corruption Write-up Advanced

(CVE-2021-1790) macOS/iOS CoreText libhvf Out-Of-Bounds Read

A parsing flaw in the HierVariation table handling of a CoreText font library allows an out-of-bounds read when a crafted font is loaded. An attacker could deliver a malicious PDF containing such a font and potentially achieve remote code execution.

starlabs.sg

Published on starlabs.sg

This vulnerability exists in libhvf.dylib, a part of CoreText library is widely used in macOS, iOS, iPadOS to parse font. An attacker can craft an evil PDF contains the malicious font that could lead to remote code execution.

The author, on starlabs.sg

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the HierVariation table parser in libhvf.dylib does not properly validate table lengths or offsets, leading to an out-of-bounds read.

Impact

A crafted PDF with a malicious font could lead to remote code execution, though the text does not demonstrate a working exploit.

What the attacker needed

Victim opens a crafted PDF; font parser feature enabled via plist

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Fonts are complex files, and the software that reads them can make mistakes when handling unusual data. Here, a specially built font inside a PDF makes the font reader look past the end of a memory buffer, which can crash the app or, in the worst case, let an attacker run their own code.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.