CVE-2026-112900
Pillow 2.6.0‑13.0.0 allows Ghostscript argument injection via crafted EPS filenames.
- CVSS 9.2
- CWE-78
- Input Validation and Sanitization
- Remote
Pillow is a Python imaging library. From 2.6.0 until 13.0.0, Pillow is vulnerable to argument injection when invoking Ghostscript for EPS input. EpsImagePlugin.Ghostscript passes a caller-controlled input filename after -f without converting it to a safe absolute path, so a name beginning with a hyphen can be interpreted as a Ghostscript option. An attacker who controls the filename can inject Ghostscript arguments. Arbitrary command execution specifically requires a leading @ argument-file filename and control of the referenced text file containing additional Ghostscript arguments; the reported chain reproduces with the default -dSAFER invocation. This issue is fixed in version 13.0.0.
- CWE
- CWE-78
- CVSS base score
- 9.2
- Published
- 2026-10-19
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Pillow
- Fixed by upgrading
- Yes
Solution
Upgrade Pillow to version 13.0.0 or later.
Vulnerable code sample
import os
from PIL import EpsImagePlugin
def convert_eps_to_png(eps_path, out_path):
# VULNERABLE: passes untrusted filename directly to Ghostscript (-f)
gs_cmd = ["gs", "-dSAFER", "-f", eps_path, "-sOutputFile=" + out_path, "-sDEVICE=pngalpha"]
EpsImagePlugin.Ghostscript(gs_cmd)Patched code sample
import os
from PIL import EpsImagePlugin
def convert_eps_to_png(eps_path, out_path):
# FIX: use absolute path to prevent option injection
safe_path = os.path.abspath(eps_path)
gs_cmd = ["gs", "-dSAFER", "-f", safe_path, "-sOutputFile=" + out_path, "-sDEVICE=pngalpha"]
EpsImagePlugin.Ghostscript(gs_cmd)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Transform EPS file name to an absolute path before invoking Ghostscript (#10090) (python-pillow/Pillow)
src/PIL/EpsImagePlugin.py · Ghostscript
Cite this entry
@misc{vaitp:cve2026112900,
title = {{Pillow 2.6.0‑13.0.0 allows Ghostscript argument injection via crafted EPS filenames.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-112900},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112900/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
