Tetrak
GitHub ↗
Security · Pillow

A 512-byte XBM file stalls Image.open() for minutes

A regular expression in XbmImagePlugin takes about six minutes of CPU on a crafted 512-byte file before Image.open() gives up.

Advisory
CVE-2026-112901 (also GHSA-xgh8-jp6q-p5x8, PYSEC-2026-4335)
Library
Pillow, pillow on PyPI
Published
Severity
6.9 out of 10, as published
Affected
<= 12.3.0
Fixed in
13.0.0
Reaches you
by opening a file

What triggers it

Opening a crafted file that looks enough like an XBM for Pillow to try its XBM reader.

What sillybos does

Refused by default

sillybos refuses the triggering file under its default policy, through the formats check.

XBM is not a format the check knows, so the file is refused as an unknown format; with formats=[...] set, Pillow never tries the XBM reader either.

Proved by this test in the sillybos suite, which builds the triggering file from bytes and checks that it is refused:

How to protect yourself

In general. Upgrade to Pillow 13.0.0.

Specifically. Allow-list the formats you mean to read.

The general advice applies to every row here.

Sources