Pillow: NULL pointer dereference in rank filters for zero-size images
Summary
Pillow, a Python imaging library, can crash the whole Python process when a median, minimum, maximum or rank filter is applied to an image with zero width or zero height. Such images can be created with ordinary calls such as cropping with equal edges, or through a crafted multi-page TIFF. An attacker who can supply crop coordinates or an uploaded image to an application that applies these filters can stop its worker process; the flaw causes a denial of service only, without memory disclosure or code execution.
Affected
- Pillow versions before 13.0.0 (the advisory lists affected versions as <= 12.3.0)
Fixed in
- Pillow 13.0.0 (fix commit 443e3130a8c11594fd0e296afad497e11e678961)
Workaround
- Validate that images have a non-zero width and height before applying a median, minimum, maximum or rank filter.
- A Python-level guard in the rank filter code also stops the crash. These workarounds are not a substitute for upgrading.
Exploitation
- CISA SSVC lists exploitation as 'poc' and automatable as yes.
- No known exploitation in the wild according to available sources.
Our recommendation
- Upgrade Pillow to 13.0.0 or later. Pillow 13 requires Python 3.11 or newer, so upgrade Python first where needed.
- Check dependency trees and container images for indirect Pillow installs, and check for version pins below 13.0.0.
- Prioritise internet-facing services that accept uploaded images and apply rank or median filters to them.
- Until patched, validate image dimensions before filtering and monitor for unexpected worker crashes.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- GitHub Security Advisory GHSA-27h8-gf7j-v5hc github.com
- Pillow 13.0.0 release github.com
- Fix commit 443e3130a8c11594fd0e296afad497e11e678961 github.com
- Pillow 13.0.0 release notes github.com
- OSV GHSA-27h8-gf7j-v5hc osv.dev
- OpenCVE CVE-2026-112392 app.opencve.io
- OffSeq radar CVE-2026-112392 radar.offseq.com
- Strix CVE-2026-112392 www.strix.ai
Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 1 Nov 2026, 15:40.
Original description (NVD)
Pillow is a Python imaging library. Prior to 13.0.0, Pillow's rank-based filters can dereference invalid image storage for a zero-size image. ImagingExpand() allocates a non-empty output and then faults while replicating edges by reading the first pixel from empty input storage; ImagingRankFilter is never reached. An attacker can supply or cause creation of a zero-size image to an application that applies a rank, median, minimum, or maximum filter. This causes a native process crash. This issue is fixed in version 13.0.0.
NVD references (4)
- https://github.com/python-pillow/Pillow/commit/443e3130a8c11594fd0e296afad497e11e678961
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-27h8-gf7j-v5hc
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-27h8-gf7j-v5hc
Sources
The tracker combines official, freely usable data sources – updated continuously:
- NVD (NIST) – CVEs, rating (CVSS), affected products
- CISA KEV – vulnerabilities confirmed by CISA as actively exploited
- CISA Vulnrichment – CISA assessment (SSVC) in the official CVE record
- FIRST EPSS – probability of exploitation
- Microsoft MSRC – Patch Tuesday: vulnerabilities, severity, updates
- PoC-in-GitHub – public proof-of-concept repositories
- Metasploit (Rapid7) – modules of the Metasploit Framework
- Exploit-DB (OffSec) – archive of public exploits (links only)
- Patch days: official vendor pages (linked per vendor) (Vendor patch days)
This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.
Affected? We can help.
We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.
