CVE-2026-96637 — Pillow: Decompression bomb check bypass in pillow
Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek() leads to unbounded allocation DoS
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.46%). Schedule for your next planned update.
Does your project use an affected pillow version?
Paste your requirements.txt to check it for CVE-2026-96637 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
SpiderImagePlugin's seek() bypasses the decompression bomb check, allowing a tiny (<1KB) crafted SPIDER stack file to trigger a multi-gigabyte allocation on im.load().
Affected versions
All versions up to and including current HEAD (v13.0.0.dev0, commit e7a7ea84)
Root cause
Image.open() runs Image._decompression_bomb_check(im.size) exactly once, in _open_core (src/PIL/Image.py:3668), right after the initial _open().
SPIDER stack files are multi-frame: SpiderImageFile.seek(frame) (SpiderImagePlugin.py:179-190) computes an attacker-influenced stkoffset and calls self._open() AGAIN directly (line 190) — NOT through Image.open(). _open() re-parses a fresh 27-float header at that offset and reassigns:
self._size = int(h[12]), int(h[2]) # SpiderImagePlugin.py:131
straight from unvalidated header floats (isSpiderHeader only checks internal labrec*lenbyt==labbyt consistency, never bounds nsam/nrow). No bomb check runs on this new size.
On the subsequent load(), ImageFile.load_prepare() (ImageFile.py:436-437) executes self.im = Image.core.new(self.mode, self.size) with the unchecked, attacker-chosen size. Mode is always "F" (4 bytes/pixel), so e.g. 40000x40000 = 6.4 GB.
Why this is a real bug
Sibling multi-frame plugins DO re-check on their alternate paths:
- GifImagePlugin.py:286 - Image._decompression_bomb_check(self._size) (in seek)
- TiffImagePlugin.py:1309 - Image._decompression_bomb_check(self._tile_size)
- IcnsImagePlugin.py:121/138, IcoImagePlugin.py:236/240 (sub-image selection)
SpiderImagePlugin has NO bomb check anywhere. This is the same class of bug just fixed for GdImageFile (GHSA-phj9-mv4w-65pm) and the FontFile classes (GHSA-5x94/8v84/45hq): an allocation reached on a non-Image.open() path sized by an attacker header field, independent of the one-time pixel bomb check.
Reproduction
Python 3.13, Pillow HEAD e7a7ea84
Attached: pillow_poc_spider_bomb.py
Sets Image.MAX_IMAGE_PIXELS=5000, then:
- CONTROL: Image.open(standalone 100x100 SPIDER) -> DecompressionBombWarning fires correctly.
- BYPASS: Image.open(stack, frame0=1x1) passes; im.seek(1) sets size (100,100) with NO DecompressionBombWarning/Error -> the check is bypassed.
Real-world impact: a large frame-1 nsam/nrow (e.g. 40000x40000) causes im.load() to allocate ~6.4 GB (mode F) with the bomb check fully bypassed, from a file under 1 KB.
Suggested fix
Call Image._decompression_bomb_check(self.size) at the end of SpiderImageFile._open() (or in seek() after _open()), mirroring GifImagePlugin / TiffImagePlugin. Optionally validate nsam/nrow are positive and sane in _open().
Credit: Yazan Balawneh - CyStack Security Team pillow_poc_spider_bomb.py
Advisory Timeline
- First published October 22, 2026 (35 days ago).
- Last revised October 29, 2026 — 7 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "pillow>=13.0.0"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: PyPI (1).
| Package | Fixed In |
|---|---|
| pillow PyPI · Affected: 1.0, 1.1, 1.2, 1.3 (+103 more) | 13.0.0 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-400Uncontrolled Resource ConsumptionMITRE
- CWE-409
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.5 score means for each attack dimension.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
References
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-g842-9rc4-69pwWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-96637ADVISORY
- https://github.com/python-pillow/Pillow/pull/10076WEB
- https://github.com/python-pillow/Pillow/commit/7cb0e02389d8aac2a60896a490f572db0b07b841WEB
- https://github.com/python-pillow/PillowPACKAGE
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0WEB
Frequently Asked Questions
- What is CVE-2026-96637?
- Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek() leads to unbounded allocation DoS. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 6.5/10).
- How do I check if my project is affected by CVE-2026-96637?
- CVE-2026-96637 affects pillow. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-96637 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 31.8% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-112900CRITICAL
Pillow: Argument Injection in Ghostscript call, potentially leading into RCE
- CVE-2026-112896HIGH
- CVE-2026-112901HIGH
- CVE-2026-54058HIGH
Pillow: Out-of-bounds read via attacker-controlled row stride on Pillow's mmap path (McIdas AREA files)
- CVE-2026-112400HIGH
Pillow: GIF seek keeps rejected size after DecompressionBombError, allowing DoS
- CVE-2026-59199HIGH
Pillow: Heap out-of-bounds write `Image.paste()` / `Image.crop()` via signed coordinate overflow
- CVE-2026-40192HIGH
FITS GZIP decompression bomb in Pillow
- CVE-2026-96636MEDIUM