Impact
Pillow, a widely used Python imaging library, contains a heap buffer overflow in its JPEG decoder when processing certain 8‑bit lossless SOF3 images. The flaw occurs during downscaling via draft() or thumbnail() because the decoder does not verify that the decoded width and component count match the requested size. If an attacker supplies a malicious JPEG, the program can corrupt heap memory, crash, or potentially execute arbitrary code.
Affected Systems
Any system running Pillow prior to version 13.0.0 is potentially affected. The issue is tied to builds of Pillow linked with libjpeg‑turbo 3.x; older libjpeg‑turbo 2.x or IJG builds reject the problematic SOF3 input. The fix is delivered in Pillow 13.0.0 and later.
Risk and Exploitability
The CVSS score of 9.2 indicates critical severity. Although the EPSS score is not available, the vulnerability is not listed in CISA's KEV catalog. The attack vector is likely local or remote depending on how the application receives JPEG input; a compromised image can trigger heap corruption and lead to code execution. As the failure mode is a buffer overflow, exploiting it generally requires the attacker to provide a crafted JPEG that the application will process, making prevention through input validation a key mitigation factor.
OpenCVE Enrichment
Github GHSA