CVE-2026-96778: Pillow heap overflow in JPEG encoding with ICC profile

CVE-2026-96778 · Severity: high · CVSS 4 · Published 2026-10-21

Pillow is a Python library for processing images. When re-saving an untrusted JPEG image with certain ICC color profile characteristics, an attacker can overflow a buffer and potentially crash the application or execute arbitrary code. This affects images with ICC profiles combined with specific comment data processed through Pillow versions 9.4.0 through 12.x.

Technologies: pillow (PyPI), Python Pillow Pillow. Vendors: PyPI, Python Pillow.

Quick answers

Is CVE-2026-96778 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-96778 being exploited in the wild.
How severe is CVE-2026-96778?
High severity, with a CVSS score of 4, published 21 October 2026.
Which products and versions are affected?
pillow (PyPI) >= 9.4.0, < 13.0.0, ECOSYSTEM:introduced=9.4.0,fixed=13.0.0; Python Pillow Pillow 9.4.0 through 12.x (before 13.0.0).
Is there a fix for CVE-2026-96778?
Yes. pillow (PyPI): upgrade to 13.0.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-96778 attacked?
It is attacked over the network or with local access, in a software library.
Am I affected by CVE-2026-96778?
Check whether you run pillow (PyPI) or Python Pillow Pillow 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 13.0.0 or later
    pip install "pillow>=13.0.0"

Technical details

A heap overflow exists in ImagingJpegEncode() within src/libImaging/JpegEncode.c when an ICC profile exactly fills the 65536-byte encoder buffer, causing jpeg_write_marker() to write one byte before checking the buffer exhaustion counter, which wraps and allows attacker-controlled data to overwrite adjacent heap memory. The vulnerability requires re-saving an untrusted JPEG with its ICC profile and comment preserved. Exploitation can lead to process crash or code execution depending on heap layout.

Affected products

  • Python Pillow Pillow 9.4.0 through 12.x (before 13.0.0)

Identifiers

  • CVE-2026-96778
  • GHSA-g7cr-3p24-7wf7

Timeline

  • 2026-10-21: disclosed
  • 2026-10-05: patched: Fix commit merged to main branch

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.