CVE-2026-96637
SpiderImageFile.seek can bypass decompression bomb check, enabling huge memory allocation.
- CVSS 7.1
- CWE-400
- Resource Management
- Remote
Pillow is a Python imaging library. Prior to 13.0.0, SpiderImageFile.seek() in src/PIL/SpiderImagePlugin.py reparses a later SPIDER stack frame and replaces self._size without rerunning Image._decompression_bomb_check(). A tiny file can use a safe first frame to pass Image.open() and then declare very large dimensions in a later mode F frame. Loading that frame allocates approximately four bytes per attacker-declared pixel and can consume multiple gigabytes of memory. This issue is fixed in version 13.0.0.
- CWE
- CWE-400
- CVSS base score
- 7.1
- Published
- 2026-10-21
- OWASP
- A08 Software and Data Integrity Failures
- 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 later.
Vulnerable code sample
from PIL import Image
def load_spider_image(path):
"""
Open a Spider-format image and advance to the second frame.
The library incorrectly updates the image size without
re‑running the decompression‑bomb check, allowing a crafted
file to inflate memory usage.
"""
img = Image.open(path) # VULNERABLE: unsafe frame advance
img.seek(1) # advance to later SPIDER stack frame
# The library internally assigns a huge size here without a safety check
return img.tobytes() # triggers allocation based on the bogus sizePatched code sample
from PIL import Image
def load_spider_image(path):
"""
Open a Spider-format image and advance to the second frame.
The fix forces a decompression‑bomb verification after the
size is potentially altered by the frame change.
"""
img = Image.open(path) # FIX: enforce size validation after frame change
img.seek(1) # advance to later SPIDER stack frame
img._decompression_bomb_check() # ensure new dimensions are safe
return img.tobytes() # safe allocation respecting the checked sizePublished 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.
- Add decompression bomb check after SPIDER seek (#10076) (python-pillow/Pillow)
src/PIL/SpiderImagePlugin.py · SpiderImageFile.seek
Cite this entry
@misc{vaitp:cve202696637,
title = {{SpiderImageFile.seek can bypass decompression bomb check, enabling huge memory allocation.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-96637},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-96637/}}
}
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 ::
