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

CVE-2026-96636: Pillow Python Library DOS Vulnerability

CVE-2026-96636 is a memory exhaustion denial of service flaw in Pillow Python imaging library affecting multi-frame image processing. This post explains its technical details, affected versions, and mitigation steps.

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

CVE-2026-96636 is a denial-of-service vulnerability in the Pillow Python imaging library affecting versions prior to 13.0.0. The flaw resides in MpoImageFile.seek() and DcxImageFile.seek(), which reparse later MPO or DCX frames and replace self._size without rerunning Image._decompression_bomb_check(). A crafted multi-frame image can use a tiny first frame to pass Image.open() and then declare an over-limit later frame. Normal frame iteration through seek(), load(), or ImageSequence.Iterator decodes that frame and allocates hundreds of megabytes of memory, exhausting process resources.

Critical Impact

Attackers can submit a small, innocuous-looking multi-frame image to any service that iterates Pillow frames and trigger memory-exhaustion denial of service against the host process.

Affected Products

  • Python Pillow imaging library versions prior to 13.0.0
  • Applications and web services that process user-supplied MPO (Multi-Picture Object) images with Pillow
  • Applications and web services that process user-supplied DCX fax images with Pillow

Discovery Timeline

  • 2026-10-21 - CVE CVE-2026-96636 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-96636

Vulnerability Analysis

The vulnerability is a resource exhaustion flaw (CWE-400) in Pillow's multi-frame image handlers. Pillow runs Image._decompression_bomb_check() when a file is first opened to reject images whose pixel count exceeds the configured limit. The check compares the parsed self._size tuple against MAX_IMAGE_PIXELS and raises DecompressionBombError or a warning.

For MPO and DCX containers, however, each frame can declare its own dimensions. When calling code advances the frame pointer with seek(), Pillow reparses the embedded sub-image and overwrites self._size with the new frame's dimensions. The decompression bomb check is not re-executed at this point, so an oversized later frame is accepted silently.

Subsequent calls to load() or iteration via ImageSequence.Iterator then allocate a raster buffer sized to the fraudulent dimensions. The decoder commits hundreds of megabytes or more of resident memory, which can crash the worker process or starve the host of RAM.

Root Cause

The root cause is missing re-validation of image size after reparsing nested frames. The initial Image.open() safety check protects only the first frame; MpoImageFile.seek() and DcxImageFile.seek() trust frame headers parsed from attacker-controlled input without reapplying the same guard.

Attack Vector

Exploitation requires user interaction, typically uploading a crafted image to a service that enumerates its frames. The attack is network-reachable wherever Pillow processes untrusted images, such as avatar uploads, document conversion pipelines, thumbnail generators, or OCR preprocessors. No authentication or elevated privileges are required.

python
# Security patch in src/PIL/DcxImagePlugin.py - add bomb check after reparse
         self.fp = self._fp
         self.fp.seek(self._offset[frame])
         PcxImageFile._open(self)
+        Image._decompression_bomb_check(self.size)

     def tell(self) -> int:
         return self.frame

Source: Pillow commit f1acfc5

python
# Security patch in src/PIL/MicImagePlugin.py - same pattern applied to MIC container
         self.fp = self.ole.openstream(filename)

         TiffImagePlugin.TiffImageFile._open(self)
+        Image._decompression_bomb_check(self.size)

         self.frame = frame

Source: Pillow commit f1acfc5

The fix calls Image._decompression_bomb_check(self.size) immediately after the nested _open() reparse so that every frame transition is validated against the same pixel limit as the initial open.

Detection Methods for CVE-2026-96636

Indicators of Compromise

  • Worker processes terminated by the OOM killer shortly after image upload, with Pillow frames visible in the Python traceback.
  • Sudden spikes in resident set size (RSS) of image-processing workers correlated with .mpo, .jpg (MPO-encoded), or .dcx uploads.
  • Application logs containing DecompressionBombWarning for frames beyond index 0, or exceptions from MpoImageFile.seek and DcxImageFile.seek.

Detection Strategies

  • Inventory Python dependencies and flag installations where Pillow<13.0.0 is present, including transitive requirements pulled in by frameworks and ML libraries.
  • Instrument image-processing endpoints to log file format, declared frame count, and per-frame dimensions before decoding, and alert when later frames exceed first-frame pixel count by a large margin.
  • Enable Image.MAX_IMAGE_PIXELS enforcement and treat DecompressionBombError as a security event rather than a user error.

Monitoring Recommendations

  • Monitor memory ceilings on image-processing containers with cgroup limits and alert on OOM kills referencing PIL or Pillow in stack traces.
  • Track request-to-response latency and 5xx rates on upload endpoints to catch degradation caused by probe payloads.
  • Correlate upload source IPs with repeated OOM events to identify active exploitation attempts.

How to Mitigate CVE-2026-96636

Immediate Actions Required

  • Upgrade Pillow to version 13.0.0 or later in all application, container, and CI environments.
  • Audit image-handling code paths that call seek(), load(), or ImageSequence.Iterator on untrusted input and ensure they run under the patched library.
  • Enforce per-process memory limits on image workers so a single bomb cannot destabilize the host.

Patch Information

The fix is included in Pillow 13.0.0 via pull request #10011 and commit f1acfc5. The patch inserts Image._decompression_bomb_check(self.size) after each nested _open() call in the DCX, MPO, MIC, and related multi-frame plugins. See GHSA-p8hx-v2p6-rp84 for the full advisory.

Workarounds

  • Lower PIL.Image.MAX_IMAGE_PIXELS to a conservative value appropriate for your workload so the first-frame check rejects more payloads outright.
  • Reject MPO and DCX uploads at the application boundary when these formats are not required.
  • Run image decoding in isolated subprocesses with strict RLIMIT_AS or container memory limits so an exhaustion attempt kills only the worker.
bash
# Pin the patched Pillow release
pip install --upgrade 'Pillow>=13.0.0'

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

# Optional defense-in-depth: lower the pixel ceiling in application startup
python -c "from PIL import Image; Image.MAX_IMAGE_PIXELS = 50_000_000"

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.