Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-112405 Overview
CVE-2026-112405 is a null pointer dereference vulnerability in Pillow, a widely used Python imaging library. The flaw exists in the Image.merge() function from version 12.0.0 up to (but not including) 13.0.0. Validation logic skips the first input band, which allows a 32-bit integer or floating-point image backed by image32 storage to be merged as a narrower multiband image. The resulting dereference of a null image8 plane causes the native process to crash. Attackers can trigger the condition by supplying a crafted IPTC file that an application opens and loads, or by calling Image.merge() directly with a malicious first band.
Critical Impact
Remote attackers can crash any application that loads untrusted IPTC images or invokes Image.merge() with attacker-controlled band inputs, producing a denial-of-service condition in Python services that depend on Pillow for image processing.
Affected Products
- Pillow 12.0.0 through versions prior to 13.0.0
- Python applications and services that use Pillow's Image.merge() on untrusted image bands
- Web services, image pipelines, and ML preprocessing stacks that parse user-supplied IPTC files via Pillow
Discovery Timeline
- 2026-10-19 - CVE-2026-112405 published to NVD
- 2026-10-20 - Last updated in NVD database
Technical Details for CVE-2026-112405
Vulnerability Analysis
The defect resides in ImagingMerge() within src/libImaging/Bands.c. Pillow uses two internal storage layouts: image8 for 8-bit single-byte planes and image32 for 32-bit integer or floating-point planes. When Image.merge() combines bands into a narrower multiband image, it iterates over the input bands and copies pixel data from each band's image8 plane. The merge path assumes every input band provides a valid image8 pointer.
The band validation loop skips index zero and only checks subsequent bands. An attacker-controlled first band using image32 storage therefore bypasses the mode check. When ImagingMerge() later dereferences firstBand->image8, the pointer is null, and the native CPython process terminates. The weakness is classified as [CWE-476] Null Pointer Dereference.
Root Cause
The root cause is incomplete input validation of band storage modes. The initial bandsCount = 0 initializer combined with the loop structure caused the first band to escape mode checking entirely. Any caller that provides a 32-bit integer or floating-point band as the first argument reaches the vulnerable dereference.
Attack Vector
Exploitation is network-reachable because many services ingest IPTC metadata from uploaded images without additional validation. A crafted IPTC file passed to Image.open() and load() triggers the merge path internally. Direct API callers that pass attacker-influenced bands to Image.merge() are equally affected. Impact is limited to availability; no memory disclosure or code execution has been demonstrated.
// Patch excerpt from src/libImaging/Bands.c
Imaging
ImagingMerge(const ModeID mode, Imaging bands[4]) {
int i, x, y;
- int bandsCount = 0;
+ int bandsCount;
Imaging imOut;
Imaging firstBand;
Source: GitHub Pillow commit b6ee66e. The fix removes the misleading initializer and raises ValueError when callers attempt to merge image32-backed bands, blocking the null dereference path.
Detection Methods for CVE-2026-112405
Indicators of Compromise
- Unexpected native crashes or SIGSEGV signals in Python processes that embed Pillow during image upload or IPTC parsing.
- Repeated worker restarts in web frameworks (uWSGI, Gunicorn, Celery) correlated with image-processing endpoints.
- Uploaded IPTC files whose bands declare I, F, or other 32-bit modes supplied where single-band 8-bit input is expected.
Detection Strategies
- Inventory installed Pillow versions across build artifacts, container images, and virtual environments; flag any instance between 12.0.0 and 13.0.0.
- Add runtime instrumentation around PIL.Image.merge() calls to log band modes before invocation.
- Scan dependency manifests (requirements.txt, pyproject.toml, Pipfile.lock, SBOMs) for vulnerable Pillow ranges during CI.
Monitoring Recommendations
- Alert on abnormal rates of process termination for services exposed to user-supplied images.
- Capture and retain crash dumps from image-processing workers to confirm the null dereference signature in ImagingMerge.
- Track inbound IPTC uploads and sample their band modes for anomalous 32-bit storage declarations.
How to Mitigate CVE-2026-112405
Immediate Actions Required
- Upgrade Pillow to version 13.0.0 or later in all production, staging, and build environments.
- Rebuild and redeploy container images, serverless packages, and ML pipelines that pin an affected Pillow release.
- Restrict and validate image upload endpoints until the patched version is confirmed deployed.
Patch Information
The vulnerability is fixed in Pillow 13.0.0. The upstream fix is tracked in GitHub Security Advisory GHSA-cp9v-662q-vvx9 and shipped in the Pillow 13.0.0 release. The code change raises ValueError when Image.merge() receives image32-backed bands, preventing the null dereference.
Workarounds
- Reject uploaded images whose declared mode is I, F, or other 32-bit variants before passing them to Pillow.
- Wrap Image.merge() and Image.open() calls in defensive code that verifies each band's mode is L, P, or another 8-bit mode prior to merging.
- Isolate image-processing workloads in sandboxed worker processes so that crashes do not degrade the broader application.
# Upgrade Pillow to the fixed release
pip install --upgrade "Pillow>=13.0.0"
# Verify the installed version
python -c "import PIL; print(PIL.__version__)"
# Audit dependency tree for pinned vulnerable versions
pip list --format=columns | grep -i pillow
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

