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.
Published: 2026-10-21
Score: 7.7 High
EPSS: < 1% Very Low
KEV: No
Impact: Potential code execution via heap buffer overflow
Action: Immediate Patch
AI Analysis

Impact

A heap buffer overflow in Pillow occurs when the library processes a JPEG image that contains an ICC profile that exactly fills the 65536‑byte encoder buffer while also appending a JPEG COM comment. The internal libjpeg routine writes one byte before verifying that the free space counter has not been exhausted, allowing the attacker‑controlled comment and following image data to overwrite adjacent heap memory. Overwrite can lead to a crash and, in certain memory layouts, the potential to execute arbitrary code.

Affected Systems

The vulnerability affects the Pillow image library, version 9.4.0 through 13.0.0. Applications that use any of these releases to re‑save or re‑encode JPEG images created by untrusted sources are at risk.

Risk and Exploitability

The CVSS score of 7.7 indicates moderate severity. Although the EPSS score is not available and the flaw is not listed in the CISA KEV, the attack requires that the application re‑encode an image with a specific ICC profile and comment. This is likely in web or desktop applications that allow user image uploads. Crash is guaranteed; code execution is possible only with a suitable heap layout, so the risk is less certain but significant enough to warrant immediate attention.

Generated by OpenCVE AI on October 22, 2026 at 05:59 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Pillow to version 13.0.0 or later.
  • Before re‑encoding, strip any ICC profile and COM comment from user‑provided JPEG images.
  • Apply strict validation to enforce that only trusted, internal images are re‑encoded, rejecting or sanitizing untrusted uploads.

Generated by OpenCVE AI on October 22, 2026 at 05:59 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-g7cr-3p24-7wf7 Pillow: Heap buffer overflow writing JPEG comment after ICC profile fills buffer
History

Wed, 28 Oct 2026 02:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Tue, 27 Oct 2026 14:45:00 +0000

Type Values Removed Values Added
First Time appeared Python
Python pillow
CPEs cpe:2.3:a:python:pillow:*:*:*:*:*:*:*:*
Vendors & Products Python
Python pillow
Metrics cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}


Thu, 22 Oct 2026 12:30:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

cvssV3_1

{'score': 8.1, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H'}

threat_severity

Important


Thu, 22 Oct 2026 04:45:00 +0000

Type Values Removed Values Added
First Time appeared Python-pillow
Python-pillow pillow
Vendors & Products Python-pillow
Python-pillow pillow

Wed, 21 Oct 2026 21:00:00 +0000

Type Values Removed Values Added
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.
Title Pillow: Heap buffer overflow writing JPEG comment after ICC profile fills buffer
Weaknesses CWE-787
References
Metrics cvssV4_0

{'score': 7.7, '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'}


Subscriptions

Python Pillow
Python-pillow Pillow
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-10-28T01:53:22.401Z

Reserved: 2026-09-23T16:25:20.414Z

Link: CVE-2026-96778

cve-icon Vulnrichment

Updated: 2026-10-28T01:53:13.639Z

cve-icon NVD

Status : Modified

Published: 2026-10-21T21:20:33.093

Modified: 2026-10-28T02:17:08.253

Link: CVE-2026-96778

cve-icon Redhat

Severity : Important

Publid Date: 2026-10-21T20:58:24Z

Links: CVE-2026-96778 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-10-22T06:00:14Z

Weaknesses