# CVE-2026-42311: Pillow integer overflow and OOB write in PSD processing

Source: https://junglewise.ai/threats/cve-2026-42311-pillow-integer-overflow-and-oob-write-in-psd-processing  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-09. Updated: 2026-07-25  
License: CC BY 4.0 with a link back

CVE-2026-42311 · Severity: high · CVSS 7.8 · Published 2026-05-09

Pillow, a widely used Python library for image processing, contains a vulnerability when handling Adobe Photoshop (PSD) files. If a user or automated system processes a specially crafted, malicious PSD file, it could cause the application to crash or allow an attacker to execute unauthorized code. This could lead to data theft or a complete takeover of the system running the software.

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

## Quick answers

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

**How severe is CVE-2026-42311?** High severity, with a CVSS score of 7.8, published 9 May 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-42311?** 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-42311 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-42311?** 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

An integer overflow vulnerability exists in the PSD image plugin of Pillow between versions 10.3.0 and 12.2.0. The flaw occurs when the library adds tile extents together without proper validation, leading to an out-of-bounds (OOB) write. An attacker can exploit this by providing a malicious PSD file that, when opened or processed, triggers memory corruption. This can result in a denial-of-service (crash) or arbitrary code execution in the context of the application. The vulnerability is addressed in version 12.2.0 by ensuring extents are not added together in a way that causes overflow.

## Affected products

- python-pillow Pillow >= 10.3.0, < 12.2.0

## Identifiers

- CVE-2026-42311
- GHSA-pwv6-vv43-88gr
- PYSEC-2026-2252

## Timeline

- 2026-04-01: patched: Fix committed and version 12.2.0 released.
- 2026-05-09: disclosed: Initial advisory published.

## References

- [https://github.com/python-pillow/Pillow/commit/58f9a1d166dcb0c274807d4423522d205b0c35ea](https://github.com/python-pillow/Pillow/commit/58f9a1d166dcb0c274807d4423522d205b0c35ea)
- [https://github.com/python-pillow/Pillow/pull/9520](https://github.com/python-pillow/Pillow/pull/9520)
- [https://github.com/python-pillow/Pillow/releases/tag/12.2.0](https://github.com/python-pillow/Pillow/releases/tag/12.2.0)
- [https://github.com/python-pillow/Pillow/security/advisories/GHSA-pwv6-vv43-88gr](https://github.com/python-pillow/Pillow/security/advisories/GHSA-pwv6-vv43-88gr)

## 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)
