Listen to this Post
A small attacker-supplied TIFF file can be opened and loaded normally by an application, but then triggers a heap-buffer-overflow out-of-bounds read when saved back to the TIFF format while retaining original metadata. Specifically, a 1×1, 16-bit grayscale, PackBits-compressed TIFF containing tag 320 (ColorMap) with 768 SHORT values structured as three zero-filled planes of 256 entries each causes Pillow’s TIFF encoder to allocate 1536 bytes. It then passes three plane pointers separated by 256 SHORT entries to libtiff. However, with BitsPerSample set to 16, libtiff expects 65536 SHORT values per plane and attempts a 131072-byte read from a plane pointer, crossing the 1536-byte allocation boundary and causing a crash under AddressSanitizer (ASAN).
DailyCVE Form:
Platform: Pillow
Version: 12.3.0
Vulnerability : Heap Buffer Overflow
Severity : Unknown
date: 2026-08-30
Prediction: 2026-09-15
What Undercode Say:
python3.11 -I -S -B reproduce.py \ --package-path /absolute/path/to/reviewed/site-packages \ --asan-runtime /absolute/path/to/reviewed/libclang_rt.asan_osx_dynamic.dylib
import io with image_module.open(io.BytesIO(data)) as image: image.load() image.save(output, format="TIFF")
Exploit: (Educational Purposes!)
An attacker constructs a malformed 16-bit grayscale TIFF file containing a custom ColorMap tag with 768 entries while keeping the actual sample depth at 16 bits per sample. When a vulnerable application opens this file, loads its pixels, and saves it back using the libtiff encoder without reconciling metadata discrepancies, libtiff attempts to read a much larger block of memory than what was allocated by Pillow for the ColorMap array, causing an out-of-bounds read.
Protection:
Validate sample depths and associated metadata tags before passing buffers to libtiff.
Ensure encoder allocation sizes strictly match the expectations of the underlying codec for the given bit depth.
Update Pillow to patched releases where metadata reconciliation checks are enforced.
Impact:
Application termination via ASAN or segmentation fault upon saving malformed TIFF images.
Potential exposure of adjacent process memory during the invalid read operation during encoding.
🎯Let’s Practice Exploiting & Learn Patching For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

