CVE-2026-112400 in Pillow
Summary
by MITRE • 10/20/2026
Pillow is a Python imaging library. From 9.2.0 until 13.0.0, Pillow can retain a rejected GIF frame size after a decompression-bomb exception. In GifImageFile._seek, a crafted GIF can leave rejected dimensions stored after Image.DecompressionBombError; if an application catches that exception and continues processing the same image object, later seek or load operations allocate according to those dimensions and can exhaust memory, denying service. This issue is fixed in version 13.0.0.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 10/20/2026
The vulnerability identified within the Pillow Python imaging library represents a significant resource management flaw that impacts system stability through denial of service conditions. Operating between versions 9.2.0 and 13.0.0, this issue stems from improper state cleanup during exception handling sequences involving GIF image processing. Specifically, when parsing complex or maliciously crafted Graphics Interchange Format files, the library encounters a decompression bomb scenario where the potential memory footprint exceeds safe thresholds. In such cases, Pillow raises an Image.DecompressionBombError to prevent immediate catastrophic resource exhaustion. However, the internal logic within the GifImageFile._seek method fails to reset critical dimension variables associated with rejected frames before or after raising this exception.
This technical flaw creates a dangerous state inconsistency where the image object retains metadata indicating large frame dimensions despite having aborted the decompression process due to safety constraints. If an application developer implements error handling that catches the DecompressionBombError and attempts to continue processing the same image instance, subsequent operations such as seeking to different frames or loading pixel data will utilize these stale dimension values. Consequently, the library allocates memory buffers based on the rejected size rather than resetting them to a safe default or zero state. This misalignment between logical state and actual resource allocation leads to excessive memory consumption that can quickly exhaust available system resources.
The operational impact of this vulnerability is primarily centered around denial of service against applications relying on Pillow for image processing workflows. An attacker who controls the input GIF file can trigger this condition by crafting a file with specific frame dimensions designed to exceed decompression limits while ensuring the application logic proceeds past the initial exception. The resulting memory exhaustion affects not only the immediate process but potentially other processes sharing system resources, depending on the deployment environment and resource constraints. This behavior aligns closely with CWE-400, which describes uncontrolled resource consumption, as well as CWE-756, related to missing or incorrect relative reference during state transitions. Furthermore, this exploitation technique maps to MITRE ATT&CK techniques involving resource hijacking for denial of service purposes, specifically leveraging improper input validation and exception handling mechanisms.
Mitigation strategies require immediate updates to the Pillow library version 13.0.0 or later, where the underlying issue has been resolved by ensuring proper state reset upon decompression bomb detection. For environments unable to upgrade immediately, developers should implement strict isolation patterns when processing untrusted image inputs. This includes avoiding reuse of Image objects after a DecompressionBombError is raised and instead discarding the object entirely to prevent stale dimension data from influencing subsequent operations. Additionally, implementing resource limits at the application level through memory quotas or container constraints can provide an additional layer of defense against potential exploitation attempts until patching is completed.