Heap-based buffer overflow in Pillow - CVE-2026-96778

 

Heap-based buffer overflow in Pillow - CVE-2026-96778

Published: November 3, 2026


Vulnerability identifier: #VU158903
CSH Severity: High
CVSS v4: 9.2 [CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N]
CVE-ID: CVE-2026-96778
CWE-ID: CWE-122
Exploitation vector: Remote access
Exploit availability: No public exploit available

Vulnerability details

The vulnerability allows a remote attacker to cause a denial of service and potentially execute arbitrary code.

The vulnerability exists due to a heap-based buffer overflow in ImagingJpegEncode() in src/libImaging/JpegEncode.c when writing a JPEG comment after image metadata exactly fills the encoder output buffer. A remote attacker can supply a crafted JPEG or PNG containing an ICC profile and a comment to an application that re-encodes the image as JPEG while preserving the profile, causing the unchecked comment write to wrap the remaining-space counter and overwrite heap memory with comment bytes and compressed image data to terminate the process or potentially execute arbitrary code.

The demonstrated code-execution chains required knowledge of library base addresses.


Affected software

Pillow

How to mitigate CVE-2026-96778

Install security update from vendor's website.

Pillow - update to 13.0.0

External References

Related Security Bulletins