CVE-2026-112400
Pillow may reuse rejected GIF dimensions after a DecompressionBombError, causing memory exhaustion.
- CVSS 8.7
- CWE-400
- Resource Management
- Remote
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.
- CWE
- CWE-400
- CVSS base score
- 8.7
- Published
- 2026-10-19
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Pillow
- Fixed by upgrading
- Yes
Solution
Upgrade Pillow to version 13.0.0 or newer.
Vulnerable code sample
from PIL import Image, ImageSequence
def process_gif(path):
im = Image.open(path)
try:
# Attempt to read a frame that may trigger a decompression bomb
im.seek(5) # VULNERABLE: retains rejected frame dimensions after exception
except Image.DecompressionBombError:
# Swallow the exception and continue using the same image object
pass
# Later processing on the same image object
# This will allocate memory based on the previously rejected dimensions
im.load()Patched code sample
from PIL import Image, ImageSequence
def process_gif(path):
im = Image.open(path)
try:
# Attempt to read a frame that may trigger a decompression bomb
im.seek(5)
except Image.DecompressionBombError:
# FIX: reset image size to safe defaults before further use
im.size = (0, 0)
im.tile = [] # clear any pending tile information
# Safe subsequent processing; no large allocation based on rejected dimensions
im.load()Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Do not keep size from failed GIF decompression bomb check (#10116) (python-pillow/Pillow)
src/PIL/GifImagePlugin.py · GifImageFile._seek
Cite this entry
@misc{vaitp:cve2026112400,
title = {{Pillow may reuse rejected GIF dimensions after a DecompressionBombError, causing memory exhaustion.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-112400},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112400/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
