---
schema_version: '1.0'
id: security-20261023-ae9ee2
title: 'CVE-2026-96637: Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek()
  leads to unbounded allocation DoS'
url: https://osv.dev/vulnerability/GHSA-g842-9rc4-69pw
url_hash: ae9ee252ca4e2a9d374e869b1decb2dbf12e9fb0f04e4ae65590a5cf61e46654
canonical_url: https://osv.dev/vulnerability/GHSA-g842-9rc4-69pw
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-96637
- GHSA-g842-9rc4-69pw
- severity: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
- pillow
- PyPI
lang: en
published_at: '2026-10-22T15:57:17Z'
fetched_at: '2026-10-23T11:56:14.171895Z'
updated_at: '2026-10-23T13:58:13Z'
status: published
content_hash: f093646f31d537e6f14c10a95348ae25c8146707e52a824dc60cba7341435633
content_changed_at: null
license_note: full
summary: 'Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek() leads
  to unbounded allocation DoS'
summary_source: rss
summary_en: 'Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek() leads
  to unbounded allocation DoS'
summary_omitted_reason: null
redistribution: true
keywords_en:
- allocation
- bomb
- bypass
- check
- cve
- CVE-2026-96637
- Decompression
- DoS
- GHSA-g842-9rc4-69pw
- leads
- library vulnerability
- pillow
- PyPI
- severity: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
- Shay McVeigh
- software security
- SpiderImagePlugin.seek
- unbounded
entities_en:
- name: Shay McVeigh
  type: person
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: Shay McVeigh
  type: person
key_facts: []
related: []
related_auto:
- name: Bristol Crown Court
  type: organization
  weight: 1.0
- name: Bristol Magistrates Court
  type: organization
  weight: 1.0
computed_at: '2026-10-23T13:58:10Z'
---

# CVE-2026-96637: Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek() leads to unbounded allocation DoS

## TL;DR
Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek() leads to unbounded allocation DoS

## Key Points
- cve / CVE-2026-96637 / GHSA-g842-9rc4-69pw / severity: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 / pillow / PyPI

## Details
**Severity:** 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
**Advisory:** GHSA-g842-9rc4-69pw (CVE-2026-96637)

**Details:**
## 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](https://github.com/user-attachments/files/30244916/pillow_poc_spider_bomb.py)

**References:**
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-g842-9rc4-69pw
- https://nvd.nist.gov/vuln/detail/CVE-2026-96637
- https://github.com/python-pillow/Pillow/pull/10076
- https://github.com/python-pillow/Pillow/commit/7cb0e02389d8aac2a60896a490f572db0b07b841
- https://github.com/python-pillow/Pillow
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-g842-9rc4-69pw_

## Source
元記事: [CVE-2026-96637: Pillow: Decompression bomb check bypass in SpiderImagePlugin.seek() leads to unbounded allocation DoS](https://osv.dev/vulnerability/GHSA-g842-9rc4-69pw) — published 2026-10-22T15:57:17Z
