CVE-2026-112405: Pillow: NULL pointer dereference in Image.merge via an unvalidated band 0

Published Oct 19, 2026
·
Updated

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:3795 iterates for 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-160 - src/PIL/IptcImagePlugin.py:169 registers the opener with no accept function.

PoC python 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 02poc.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.

Other sources

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.

— NVD

Affected Software

7 affected componentsFixes available
pypi/Pillow>=12.0.0<13.0.0
pip/pillow>=12.0.0<13.0.0
13.0.0
Python Pillow>=12.0.0<13.0.0
bitnami/pillow>=12.0.0<13.0.0
13.0.0
ubuntu/pillow-python2*
ubuntu/pillow*
ubuntu/pillow*

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0
  2. Upgrade

    Upgrade bitnami/pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0
  3. Upgrade

    Upgrade Pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0

Event History

Oct 19, 2026
CVE Published
via MITRE·09:29 PM
Data Sourced
via MITRE·09:29 PM
DescriptionWeakness
Data Sourced
via OSV·09:29 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·09:42 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·10:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Oct 21, 2026
Advisory Published
via GitHub·08:30 PM
Data Sourced
via GitHub·08:30 PM
DescriptionWeaknessAffected Software
Oct 26, 2026
Advisory Published
via OSV·05:55 AM
Nov 4, 2026
Data Sourced
via OSV·08:03 PM
Affected Software

Frequently Asked Questions

1

Which deployments are exposed to attacker-controlled input?

Applications using Pillow 12.0.0 through versions before 13.0.0 are exposed if they open and load crafted IPTC files. The issue can also be triggered by application code that directly calls Image.merge() with a maliciously constructed first band.

2

What is the practical impact of successful exploitation?

Successful exploitation causes a NULL pointer dereference in native code, resulting in a process crash. The provided CVSS vector indicates availability impact only, with no stated confidentiality or integrity impact.

3

Does exploitation require authentication or user interaction?

No. The supplied CVSS vector indicates network reachability, low attack complexity, no privileges required, and no user interaction; however, the affected application must process the crafted IPTC file or invoke the vulnerable Image.merge() path.

4

What version resolves the issue?

Upgrade Pillow to version 13.0.0, which fixes the issue. The affected range begins at 12.0.0 and ends before 13.0.0.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203