Skip to main content
Vulnerability Database/CVE-2026-112404

CVE-2026-112404: Pillow TIFF Buffer Overflow Vulnerability

CVE-2026-112404 is a buffer overflow vulnerability in Pillow Python imaging library affecting TIFF image processing. Attackers can exploit this flaw to expose heap data or crash applications. This article covers technical details, affected versions from 8.1.0 to 13.0.0, security impact, and mitigation strategies.

Published:

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-112404 Overview

CVE-2026-112404 is an out-of-bounds read vulnerability [CWE-126] in the Pillow Python imaging library. The flaw affects TIFF tile and RGBA decode paths in versions 8.1.0 through 13.0.0. When Pillow and libtiff interpret duplicated PhotometricInterpretation or BitsPerSample tags differently, Pillow fails to verify that the required input row fits inside the row libtiff produced. A crafted TIFF file can expose adjacent heap memory in output pixels or crash the process. The strip path contains this validation, but the tile and RGBA unpacker paths do not. The issue is fixed in Pillow 13.0.0.

Critical Impact

Attackers who supply a malicious TIFF to any application using Pillow can leak adjacent heap data into decoded image output or trigger a process crash.

Affected Products

  • Pillow versions 8.1.0 through 13.0.0 (fixed in 13.0.0)
  • Python applications that decode untrusted TIFF images via Pillow
  • Web services and image processing pipelines consuming user-supplied TIFF files

Discovery Timeline

  • 2026-10-19 - CVE-2026-112404 published to NVD
  • 2026-10-20 - Last updated in NVD database

Technical Details for CVE-2026-112404

Vulnerability Analysis

The vulnerability resides in _decodeTile and the RGBA unpacker path within src/libImaging/TiffDecode.c. Pillow allocates a buffer sized according to its own interpretation of TIFF metadata tags. When a TIFF file contains duplicated PhotometricInterpretation or BitsPerSample tags, Pillow and libtiff may select different values. This disagreement causes Pillow's unpacker to read a larger row than libtiff actually produced. The strip decode path validates row sizes before unpacking, but the tile and RGBA paths skipped this check. Downstream, the unpacker reads uninitialized bytes past the end of the decoded row from the heap-allocated tile buffer.

Root Cause

The root cause is an input validation gap combined with codec state inconsistency. Codecs such as JPEG and Group 4 can succeed on a tile that decodes to fewer rows than the declared tile length, leaving the tail of the buffer uninitialized. Pillow then reused the buffer across tiles without clearing residual contents, and failed to assert that the row width expected by the RGBA unpacker matched what libtiff produced.

Attack Vector

Exploitation requires an application to load an attacker-controlled TIFF through Pillow. The attack is network-reachable wherever TIFF uploads are processed: image hosts, document pipelines, thumbnailers, OCR services, and chat applications. No authentication or user interaction beyond image submission is required. Successful exploitation discloses heap memory in pixel output or crashes the Python process, enabling denial of service.

c
         return -1;
     }
 
-    state->bytes = tile_bytes_size;
-
     /* realloc to fit whole tile */
     /* malloc check above */
-    new_data = realloc(state->buffer, state->bytes);
+    new_data = realloc(state->buffer, tile_bytes_size);
     if (!new_data) {
         state->errcode = IMAGING_CODEC_MEMORY;
         return -1;
     }
     state->buffer = new_data;
 
+    if (tile_bytes_size > state->bytes) {
+        // Some codecs (e.g. JPEG, Group 4) succeed on a tile that decodes
+        // to fewer rows than the tile length, leaving the rest of the buffer untouched.
+        // Clear it so that uninitialised memory is not copied into the image.
+        memset(state->buffer + state->bytes, 0, tile_bytes_size - state->bytes);
+    }
+
+    state->bytes = tile_bytes_size;
+
     for (y = state->yoff; y < state->ysize; y += tile_length) {
         int plane;
         for (plane = 0; plane < planes; plane++) {

Source: GitHub Pillow Commit 1d4773e

Detection Methods for CVE-2026-112404

Indicators of Compromise

  • TIFF files containing duplicated PhotometricInterpretation or BitsPerSample tags with conflicting values
  • Unexpected crashes or segmentation faults in Python processes that invoke PIL.Image.open on TIFF inputs
  • Decoded image output containing visibly anomalous pixel bands that do not match the source content

Detection Strategies

  • Inventory Python environments and container images to identify installations of Pillow between 8.1.0 and prior to 13.0.0 using pip list or SBOM tooling.
  • Instrument image ingestion services to log TIFF tag parsing anomalies and reject files with duplicate directory entries.
  • Hunt for process crash telemetry from services known to invoke Pillow against untrusted input.

Monitoring Recommendations

  • Monitor exceptions and SIGSEGV events in image processing workers and web application backends that handle uploads.
  • Alert on outbound responses containing TIFF-derived images where byte-level entropy of pixel regions deviates from baseline.
  • Track Pillow version drift in production dependencies through continuous software composition analysis.

How to Mitigate CVE-2026-112404

Immediate Actions Required

  • Upgrade Pillow to version 13.0.0 or later across all environments that decode TIFF images.
  • Audit application dependencies, including transitive dependencies, for pinned Pillow versions below 13.0.0.
  • Reject or quarantine TIFF uploads from untrusted sources until the upgrade is deployed.

Patch Information

The fix is included in Pillow 13.0.0. See the GitHub Pillow Security Advisory GHSA-c6hw-5grf-ff96 and the GitHub Pillow Release 13.0.0 notes. The patch clears the tile buffer beyond previously decoded data and aligns tile and RGBA decode paths with the strip path's size validation.

Workarounds

  • Validate TIFF metadata before decoding and reject files containing duplicated TIFF directory tags.
  • Restrict accepted upload formats to PNG or JPEG where TIFF support is not required.
  • Isolate TIFF decoding in sandboxed worker processes with constrained memory and network access.
bash
# Upgrade Pillow to the patched release
pip install --upgrade "Pillow>=13.0.0"

# Verify the installed version
python -c "import PIL; print(PIL.__version__)"

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

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.