# CVE-2026-40192: Python Pillow denial of service via FITS GZIP decompression bomb

Source: https://junglewise.ai/threats/cve-2026-40192-python-pillow-denial-of-service-via-fits-gzip-decompression-bomb  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-15. Updated: 2026-06-30  
License: CC BY 4.0 with a link back

CVE-2026-40192 · Severity: high · CVSS 7.5 · Published 2026-04-15

Pillow, a widely used Python library for image processing, is vulnerable to 'decompression bomb' attacks when handling FITS images. An attacker can provide a specially crafted image file that, when opened, consumes an excessive amount of system memory. This can lead to the application crashing or the entire server becoming unresponsive, disrupting business operations.

Technologies: [pillow (PyPI)](https://junglewise.ai/threats/technologies/pillow). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-40192 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40192 being exploited in the wild.

**How severe is CVE-2026-40192?** High severity, with a CVSS score of 7.5, published 15 April 2026.

**Which products and versions are affected?** pillow (PyPI) >= 10.3.0, < 12.2.0, ECOSYSTEM:introduced=10.3.0,fixed=12.2.0.

**Is there a fix for CVE-2026-40192?** Yes. pillow (PyPI): upgrade to 12.2.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-40192 attacked?** It is attacked over the network or with local access, in a software library.

**Am I affected by CVE-2026-40192?** Check whether you run pillow (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- pillow (PyPI): upgrade to 12.2.0 or later

  ```sh
  pip install "pillow>=12.2.0"
  ```


## Technical details

A resource exhaustion vulnerability (CWE-400) exists in Pillow's FitsImagePlugin.py. The library failed to limit the amount of GZIP-compressed data read during the decoding of Flexible Image Transport System (FITS) images. An attacker can exploit this by providing a small, highly compressed FITS file that expands to a massive size in memory upon decompression. This results in an Out-Of-Memory (OOM) condition or severe performance degradation. The issue was introduced in version 10.3.0 and is fixed in version 12.2.0 by ensuring only the necessary amount of data is read from the decompressor.

## Affected products

- Python-Pillow Pillow >= 10.3.0, < 12.2.0

## Identifiers

- CVE-2026-40192
- GHSA-whj4-6x5x-4v2j
- PYSEC-2026-2250

## Timeline

- 2026-03-31: patched: Fix merged into main branch via PR #9521
- 2026-04-01: advisory: Release notes for version 12.2.0 published
- 2026-04-10: disclosed: GitHub Security Advisory GHSA-whj4-6x5x-4v2j published
- 2026-04-15: disclosed: NVD publication date

## References

- [https://github.com/python-pillow/Pillow/commit/3cb854e8b2bab43f40e342e665f9340d861aa628](https://github.com/python-pillow/Pillow/commit/3cb854e8b2bab43f40e342e665f9340d861aa628)
- [https://github.com/python-pillow/Pillow/pull/9521](https://github.com/python-pillow/Pillow/pull/9521)
- [https://github.com/python-pillow/Pillow/security/advisories/GHSA-whj4-6x5x-4v2j](https://github.com/python-pillow/Pillow/security/advisories/GHSA-whj4-6x5x-4v2j)
- [https://pillow.readthedocs.io/en/stable/releasenotes/12.2.0.html](https://pillow.readthedocs.io/en/stable/releasenotes/12.2.0.html)
- [https://access.redhat.com/errata/RHSA-2026:16008](https://access.redhat.com/errata/RHSA-2026:16008)
- [https://access.redhat.com/errata/RHSA-2026:16009](https://access.redhat.com/errata/RHSA-2026:16009)
- [https://access.redhat.com/errata/RHSA-2026:16030](https://access.redhat.com/errata/RHSA-2026:16030)

## Related threats

- [Pillow heap buffer overflow in TIFF encoder with mismatched geometry tags](https://junglewise.ai/threats/cve-2026-128067-pillow-heap-buffer-overflow-saving-tiff-with-libtiff-when-tags)
- [Pillow memory denial of service in TIFF and EXIF parsing](https://junglewise.ai/threats/cve-2026-128066-pillow-memory-dos-in-tiff-and-exif-ifd-parsing-via-overlapping)
- [Pillow libtiff encoder memory disclosure and crash via crafted TIFF tags](https://junglewise.ai/threats/cve-2026-112902-pillow-memory-disclosure-and-segfault-in-libtiff-encoder-via)
- [Pillow EPS load decompression bomb check bypass in Ghostscript scaling](https://junglewise.ai/threats/cve-2026-112899-pillow-eps-load-scale-lets-ghostscript-render-past-the)
- [Pillow heap buffer overflow in bundled libopenjp2](https://junglewise.ai/threats/pillow-bundled-libopenjp2-2-5-4-in-all-wheels-since-11-1-0-carries-osv-cd00a842)
