Heap-based buffer overflow in Pillow - CVE-2026-96778
Published: November 3, 2026
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.