Pillow: Heap buffer overflow in JPEG decoder (ImagingJpegDecode)
Summary
Pillow, a Python imaging library, has a heap buffer overflow in its JPEG decoder (ImagingJpegDecode). When an application calls draft() or thumbnail() to request downscaling of a crafted 8-bit lossless (SOF3) JPEG, and Pillow is linked against libjpeg-turbo 3.x, the decoder writes full-width scanlines into a buffer sized for the scaled image. An attacker who can supply such a file can corrupt heap memory, crash the process or potentially execute code. Exploitation requires no authentication but has high complexity.
Affected
- Pillow versions before 13.0.0 (CVE record: affected < 13.0.0; GHSA: <= 12.3.0)
- The exact lower bound of the affected range is unknown; trackers disagree
- Builds linked against libjpeg-turbo 3.x are affected; libjpeg-turbo 2.x and IJG builds reject the SOF3 input
Fixed in
- Pillow 13.0.0 (fix commit 242a059aedc1935097d9aa1dc3f099750467ba75)
- No fix exists in the 12.x line; upgrading requires moving to a new major version (Python 3.10 is no longer supported in Pillow 13)
Workaround
- No vendor-documented workaround found: Unknown.
- Recommended (not vendor-sourced): avoid calling draft() or thumbnail() on untrusted JPEG files until the upgrade is done, and run image processing in an isolated worker with memory limits.
Exploitation
- CISA SSVC: exploitation status 'poc', not automatable.
- A public proof-of-concept repository exists; it has not been verified here.
- No evidence of active exploitation in the wild; not listed as known exploited in the sources reviewed.
Our recommendation
- Check all systems for Pillow versions below 13.0.0, including transitive dependencies in requirements files and lock files.
- Upgrade to Pillow 13.0.0 or later and test the application, since the upgrade may require a newer Python version.
- Where an upgrade is blocked, restrict upload features that process JPEG files, require authentication for them, and avoid thumbnail() or draft() on untrusted input.
- Check internet-facing upload and preview features first.
- Check Linux distribution advisories for backported packages.
Public exploits
Links to third-party sites, not checked by us – exploit code can contain malware. Only use it in isolated test environments.
- Proof of concept on GitHub (1 repositories)
al4n4n/CVE-2026-112403
Research sources
- GitHub Security Advisory GHSA-8g5g-8vmr-9782 github.com
- Pillow 13.0.0 release github.com
- Fix commit 242a059aedc1935097d9aa1dc3f099750467ba75 github.com
- Ubuntu security tracker CVE-2026-112403 ubuntu.com
- Vulners GHSA-8G5G-8VMR-9782 (version range) vulners.com
- Public proof-of-concept repository (not reviewed) github.com
Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 31 Oct 2026, 04:15.
Original description (NVD)
Pillow is a Python imaging library. Prior to 13.0.0, Pillow's JPEG decoder can write a full-width scanline into a buffer sized for a requested draft scale. ImagingJpegDecode does not verify libjpeg's actual output width and component count after scaling is requested, and an 8-bit lossless SOF3 JPEG decoded by a build linked to libjpeg-turbo 3.x can ignore the requested downscaling geometry. An attacker can supply such a JPEG to an application that uses draft() or thumbnail() to request downscaling. This can corrupt heap memory, crash the process, or potentially allow code execution. Older libjpeg-turbo 2.x and IJG builds reject the SOF3 input. This issue is fixed in version 13.0.0.
NVD references (4)
- https://github.com/python-pillow/Pillow/commit/242a059aedc1935097d9aa1dc3f099750467ba75
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-8g5g-8vmr-9782
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-8g5g-8vmr-9782
Sources
The tracker combines official, freely usable data sources – updated continuously:
- NVD (NIST) – CVEs, rating (CVSS), affected products
- CISA KEV – vulnerabilities confirmed by CISA as actively exploited
- CISA Vulnrichment – CISA assessment (SSVC) in the official CVE record
- FIRST EPSS – probability of exploitation
- Microsoft MSRC – Patch Tuesday: vulnerabilities, severity, updates
- PoC-in-GitHub – public proof-of-concept repositories
- Metasploit (Rapid7) – modules of the Metasploit Framework
- Exploit-DB (OffSec) – archive of public exploits (links only)
- Patch days: official vendor pages (linked per vendor) (Vendor patch days)
This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.
Affected? We can help.
We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.
