CVE-2026-96639: Pillow Multi-Frame Loader Reuses Stale Native Buffers for Out-of-Bounds Read/Write
What's Happening
CVE-2026-96639 is a critical (CVSS 9.8) memory-corruption flaw in the Python Pillow imaging library, rooted in how multi-frame image loaders manage native storage across frame transitions. When frame 0 of a multi-frame image allocates a C-level ImagingCore buffer for a narrow pixel mode such as L, and a subsequent frame of the same dimensions switches to a wider mode such as RGB or CMYK, Pillow fails to reallocate that buffer. The root cause is in ImageFile.load_prepare(), which only reallocates native storage when _im is None — it does not check whether the mode has changed. The decoder then writes wider pixel data into a buffer sized for the narrower mode, producing a classic CWE-125 (out-of-bounds read) / CWE-787 (out-of-bounds write) condition.
Affected Software
- Vendor/package: Pillow (pip)
- Versions: >= 11.0.0, < 13.0.0
- Verified vulnerable loaders: PSD, MPO/JPEG, DCX, and MIC
- Not affected: TIFF — its seek path already validates both mode and size before reusing storage
No patched version has been published as of this writing. Any application or service that decodes untrusted, attacker-supplied images through one of the affected loaders is a candidate for exposure — think upload pipelines, thumbnail generators, document converters, and ML preprocessing stages.
Exploitation Status
This CVE is marked public PoC. A proof-of-concept exists demonstrating the crafted multi-frame image trigger, and researchers have further shown that the MPO/JPEG path can be escalated to command execution under matching Python and Pillow runtime profiles. There is no evidence yet of in-the-wild exploitation or KEV listing, but public PoC status means working exploit code is available or readily reproducible — defenders should treat this as an active risk rather than a theoretical one, particularly for internet-facing image ingestion services.
How Our Detection Works
We ship coverage across Microsoft Sentinel (KQL), Splunk (SPL), Elastic (EQL), QRadar (AQL), Sumo Logic, Chronicle (YARA-L), and CrowdStrike (CQL). The detection logic focuses on three complementary angles rather than a single signature:
- Inventory exposure: identifying hosts and workloads running a vulnerable Pillow version (>= 11.0.0, < 13.0.0) via package manifests, container image metadata, or environment telemetry.
- Crash/anomaly telemetry: surfacing segfaults, unexpected process terminations, or memory-access exceptions in image-processing workers that correlate with Pillow decode operations — a hallmark of a triggered out-of-bounds write.
- Malicious upload patterns: flagging multi-frame image uploads (PSD, MPO/JPEG, DCX, MIC) exhibiting mode transitions between frames, a structural indicator consistent with a crafted exploit payload rather than a normal image.
Together these signals let defenders catch both pre-exploitation exposure (an unpatched, internet-facing image pipeline) and active exploitation attempts (malformed uploads or resulting worker crashes), without relying on a single brittle IOC.
Full Detection Details
For the complete KQL, SPL, and other SIEM queries, investigation guidance, and atomic tests for this vulnerability, see the full detection page: CVE-2026-96639 on df00tech.