Pillow — Critical Remote Code Execution and Buffer Overflow Vulnerabilities in Python’s Imaging Library (CVE-2026-112900)
Publication date: October 23, 2026
Category: Vulnerability / Web Security
Introduction
The Pillow library, recognized as the most widely adopted image processing framework within the Python ecosystem with approximately 436 million monthly downloads, has been impacted by multiple high-severity vulnerabilities. Initially highlighted by security firm OX Security alongside findings aided by artificial intelligence and validated by Ada Logics, these critical flaws enable operating system command execution, memory buffer overflows, and heap corruption. Project maintainers have addressed these issues by releasing version 13.0.0, which remediates vectors affecting various graphical formats including EPS, JPEG, and TIFF.
What is Pillow? (General Analysis)
Pillow serves as the modern fork and successor to the original Python Imaging Library (PIL). It plays a crucial role in modern web applications, document processing pipelines, and machine learning workflows, managing everyday tasks such as thumbnail generation, format conversion, and user-uploaded image parsing. Because this library is embedded across millions of servers and data pipelines, any flaw in handling graphical payloads immediately transforms into a mass-scale vector targeting the underlying infrastructure.
The reported vulnerabilities correspond to the following identifiers and official classifications verified within the NVD database:
- CVE-2026-112900: Argument injection in Ghostscript for EPS inputs.
- Official CVSS v4.0 Vector (Confirmed):
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(Score: 9.2 CRITICAL). - Official CWE Classification (Confirmed): CWE-78 (Improper Neutralization of Special Elements used in an OS Command) and CWE-88 (Improper Neutralization of Argument Delimiters in a Command).
- Official CVSS v4.0 Vector (Confirmed):
- CVE-2026-112403: Buffer overflow in the JPEG decoder when processing lossless compressed formats.
- Official CVSS v4.0 Vector (Confirmed):
CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N(Score: 9.2 CRITICAL). - Official CWE Classification (Confirmed): CWE-122 (Heap-based Buffer Overflow).
- Official CVSS v4.0 Vector (Confirmed):
- CVE-2026-112393: Heap buffer overflow and stale heap disclosure when saving compressed TIFF data.
- Official CVSS v4.0 Vector (Confirmed):
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N(Score: 9.2 CRITICAL). - Official CWE Classification (Confirmed): CWE-122 (Heap-based Buffer Overflow).
- Official CVSS v4.0 Vector (Confirmed):
How Does It Work? (Technical Analysis)
In-depth analysis of these incidents reveals that the flaws do not stem from the visual structure of images, but rather from improper handling of metadata, filenames, and internal buffer workflows:
- EPS Injection Flow (CVE-2026-112900):
- Exploit Entry: The
EpsImagePlugin.Ghostscriptmodule invokes the externalgsexecutable by passing the caller-controlled filename without converting it to a safe absolute path. - Execution: If an attacker controls the filename to begin with a hyphen or utilizes an argument starting with
@pointing to a text file containing extra arguments, Ghostscript interprets these strings as configuration options rather than plain file names. This enables arbitrary command execution even under the default-dSAFERinvocation.
- Exploit Entry: The
- JPEG Memory Corruption (CVE-2026-112403):
- Mechanism: When processing lossless SOF3 JPEG images using builds linked against
libjpeg-turbo3.x while requesting downscaling operations viadraft()orthumbnail(), the decoder (ImagingJpegDecode) fails to validate the actual output width returned by the underlying library. - Impact: A full-width scanline is written into a buffer sized for a requested draft scale, corrupting heap memory, crashing the process, or facilitating code execution.
- Mechanism: When processing lossless SOF3 JPEG images using builds linked against
- TIFF Overflow and Disclosure (CVE-2026-112393):
- Mechanism: When saving compressed TIFF data via
libtiffto targets lacking a usable file descriptor (such asBytesIOobjects), the internal callback_tiffWriteProcsizes its memory allocation based on the prior buffer size instead of the current write position. - Exploitation: Out-of-line TIFF tags controlled by the attacker allow exceeding the initial allocation as the pointer advances, which combined with unwritten alignment gaps larger than 64 KiB, exposes stale heap bytes.
- Mechanism: When saving compressed TIFF data via
Affected Systems / Environments
Pillow versions ranging from 2.6.0 up to 12.3.0 are vulnerable (fixed in version 13.0.0). Most exposed environments include web services featuring file upload endpoints that preserve user-supplied filenames, alongside systems processing images via Ghostscript or dependencies relying on libjpeg-turbo 3.x and libtiff.
| CVE | Category (CWE) | Impact | CVSS | Vector (summary) |
|---|---|---|---|---|
| CVE-2026-112900 | CWE-78, CWE-88 | RCE / Injection | 9.2 (CRITICAL) | AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H |
| CVE-2026-112403 | CWE-122 | Memory Corruption / DoS | 9.2 (CRITICAL) | AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H |
| CVE-2026-112393 | CWE-122 | Memory Corruption / Leak | 9.2 (CRITICAL) | AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H |
Mitigation and Detection
Remediation
- Priority Update: Immediately upgrade the Pillow library to version 13.0.0 or later using
pip install -U "Pillow>=13.0.0". Note that this version drops support for Python 3.10, requiring Python 3.11 or newer. - Ghostscript Hardening: Remove or restrict the installation of the
gsbinary on hosts processing untrusted image inputs, avoiding the passing of user-controlled filenames toImage.open()for EPS files. - Flow Isolation: Avoid utilizing downscaling methods (
draft()orthumbnail()) on untrusted JPEGs without pre-loading safeguards, and treat saving TIFF files to in-memory buffers (io.BytesIO) as sensitive paths.
Detection
- Monitor operational logs for unusual filename patterns within upload requests containing control characters, leading hyphens, or command argument references.
- Implement static dependency analysis within CI/CD pipelines to identify vulnerable Pillow versions across containers and production deployments.
“The exploitation of vulnerabilities in low-level libraries like Pillow highlights how improper sanitization of metadata and filenames can transform routine graphical operations into direct avenues for remote command execution.”
Wrapping Up
The vulnerabilities discovered in Pillow underscore the criticality of open-source dependencies within the modern software supply chain. With CVSS scores of 9.2 and vectors spanning argument injection to heap memory overflows, upgrading to version 13.0.0 is an essential requirement to protect the stability and integrity of corporate platforms and web services handling multimedia content.
References
- Khandelwal, S. (2026). Critical Flaw in Python’s Popular Pillow Image Library Allows Code Execution via a Crafted Image. The Hacker News. https://thehackernews.com/2026/10/critical-flaw-in-pythons-popular-pillow.html
- OX Security. (2026). Three critical Pillow CVEs: RCE and heap overflows in Python’s imaging library. https://www.ox.security/blog/three-critical-pillow-cves-rce-and-heap-overflows-in-pythons-imaging-library-cve-2026-112900-cve-2026-112393-cve-2026-112403/
- Python Pillow Project. (2026). Pillow Release Notes - Version 13.0.0. https://pillow.readthedocs.io/en/stable/releasenotes/13.0.0.html
- Python Pillow Project. (2026). GitHub Security Advisory: GHSA-w889-685w-c8fh. https://github.com/python-pillow/Pillow/security/advisories/GHSA-w889-685w-c8fh
- Python Pillow Project. (2026). GitHub Security Advisory: GHSA-5x8w-8jj5-q52h. https://github.com/python-pillow/Pillow/security/advisories/GHSA-5x8w-8jj5-q52h
- Python Pillow Project. (2026). GitHub Security Advisory: GHSA-8g5g-8vmr-9782. https://github.com/python-pillow/Pillow/security/advisories/GHSA-8g5g-8vmr-9782
- Python Pillow Project. (2026). GitHub Security Advisory: GHSA-332p-7hrc-92wf. https://github.com/python-pillow/Pillow/security/advisories/GHSA-332p-7hrc-92wf
- Python Pillow Project. (2026). PyPI - Pillow 13.0.0. https://pypi.org/project/pillow/13.0.0/
- Python Pillow Project. (2026). Security Guidance - Pillow Documentation. https://pillow.readthedocs.io/en/stable/handbook/security.html
- National Vulnerability Database. (2026). NVD - CVE-2026-112900. https://www.cve.org/CVERecord?id=CVE-2026-112900