PyPI: pillow
CVE-2026-112405
Safety vulnerability ID: SFTY-20261021-10844
Affected versions of the Pillow package are vulnerable to NULL Pointer Dereference due to insufficient validation of band 0 in `Image.merge()`. The validation loop in `Image.py` only checks the mode and size of `bands[1:]`, leaving band 0 unchecked, so when band 0 is a single-band `I` or `F` image its `image8` plane remains NULL while only `image32` is populated; the native `ImagingMerge` routine in `Bands.c` then dereferences this NULL `image8` pointer when constructing multi-band output. An attacker can exploit this by crafting a malicious IPTC file whose sub-image at index 0 is typed as `I` or `F`, since `IptcImagePlugin.py` builds the band list from this attacker-controlled sub-image and passes it to `Image.merge()` without an accept function to prefilter the file, causing a segmentation fault and crashing the worker process when the file is opened and loaded.
Overview
Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0
Advisory
pillow – NULL Pointer Dereference
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20261021-10844/CVE-2026-112405
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-cp9v-662q-vvx9
- https://nvd.nist.gov/vuln/detail/CVE-2026-112405
- https://github.com/python-pillow/Pillow/commit/b6ee66e8b2c2c0932bdf65f963268d9f2927ef86
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://github.com/advisories/GHSA-cp9v-662q-vvx9
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
