CVE-2026-96638 in Pillow
Summary
by MITRE • 10/23/2026
Pillow is a Python imaging library. From 9.1.0 until 13.0.0, BmpRleDecoder.decode() in src/PIL/BmpImagePlugin.py permits crafted RLE BMP delta escapes and absolute-mode runs to append beyond the remaining dest_length without a per-branch cap. A delta can add roughly 255 image rows in one iteration, so a kilobyte-sized file with a large but permitted width can expand the data bytearray to hundreds of megabytes or more, causing memory-exhaustion denial of service. This issue is fixed in version 13.0.0.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 10/23/2026
The vulnerability identified within the Pillow imaging library affects versions ranging from 9.1.0 through 13.0.0 and centers on a critical implementation flaw in the BmpRleDecoder.decode method located in src/PIL/BmpImagePlugin.py. This component is responsible for decoding Bitmap image files that utilize Run-Length Encoding, specifically handling both delta escapes and absolute-mode runs. The core technical deficiency lies in the absence of a per-branch cap when calculating the destination length during the expansion process. When processing crafted RLE BMP files containing specific malformed escape sequences or absolute-mode run descriptors, the decoder fails to validate whether the calculated size exceeds safe boundaries before appending data to the internal bytearray structure. This lack of boundary checking allows an attacker to construct input files that trigger disproportionate memory allocation relative to their actual file size on disk.
The operational impact of this flaw is severe, primarily manifesting as a denial-of-service condition through resource exhaustion. Because a single delta escape can add approximately two hundred and fifty image rows in one iteration, the expansion factor is substantial. An attacker can craft a relatively small BMP file, potentially only a few kilobytes in size with a large but permitted width, which when processed by the vulnerable decoder, causes the data bytearray to expand rapidly into hundreds of megabytes or more. This uncontrolled memory growth consumes available system resources quickly, leading to application crashes, service interruptions, and potential instability for any host running affected versions of Pillow that process untrusted image inputs. The vulnerability is effectively a classic example of improper input validation leading to resource consumption attacks.
From a classification perspective, this issue aligns with CWE-787: Out-of-bounds Write in terms of the underlying mechanism where data is written beyond intended limits due to logic errors, although it specifically results in memory exhaustion rather than code execution. It also maps closely to CWE-400: Uncontrolled Resource Consumption, as the primary consequence is the depletion of system resources such as RAM and CPU cycles during decompression. In terms of offensive security frameworks like MITRE ATT&CK, this vulnerability facilitates resource hijacking techniques where an adversary leverages software flaws to degrade service availability without necessarily gaining persistent access or executing arbitrary code directly through memory corruption exploits.
Mitigation for this issue is straightforward and requires immediate action by upgrading the Pillow library to version 13.0.0 or later, which includes patches that enforce proper bounds checking on delta escapes and absolute-mode runs during decoding operations. For environments where an upgrade is not immediately feasible, defensive measures should include implementing strict input validation at the application layer before passing image data to the decoder. This can involve limiting the maximum allowed dimensions of BMP files, restricting file sizes processed by automated systems, or utilizing sandboxed execution environments with memory limits to contain potential out-of-control expansions. Additionally, monitoring for unusual spikes in memory usage during image processing tasks can serve as an early detection mechanism for exploitation attempts targeting this specific vulnerability vector.