Skip to main content
Vulnerability Database/CVE-2026-112900

CVE-2026-112900: Pillow EPS Ghostscript RCE Vulnerability

CVE-2026-112900 is an argument injection flaw in Pillow's EPS processing that enables remote code execution through Ghostscript. This article covers the technical details, affected versions, and remediation guidance.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-112900 Overview

CVE-2026-112900 is an argument injection vulnerability in Pillow, the widely used Python imaging library. The flaw affects versions 2.6.0 through 12.x and is fixed in version 13.0.0. When Pillow processes Encapsulated PostScript (EPS) input, EpsImagePlugin.Ghostscript passes a caller-controlled input filename to Ghostscript after the -f flag without converting it to a safe absolute path. A filename beginning with a hyphen is interpreted as a Ghostscript option, and a filename beginning with @ is interpreted as an argument file. Attackers who control the filename can inject arguments, and when combined with control of a referenced text file can achieve arbitrary command execution, even under the default -dSAFER invocation.

Critical Impact

Attackers who control EPS filenames processed by Pillow can inject Ghostscript arguments and achieve arbitrary command execution on the host.

Affected Products

  • Pillow versions 2.6.0 through 12.x (all releases prior to 13.0.0)
  • Python applications invoking PIL.EpsImagePlugin on untrusted filenames
  • Services and pipelines that render user-supplied EPS images via Ghostscript

Discovery Timeline

  • 2026-10-19 - CVE-2026-112900 published to the National Vulnerability Database
  • 2026-10-20 - Last updated in NVD database

Technical Details for CVE-2026-112900

Vulnerability Analysis

The defect sits in EpsImagePlugin.Ghostscript, which constructs the Ghostscript command line for EPS rendering. Pillow forwards the on-disk filename of the input file to Ghostscript using the -f <filename> argument. Ghostscript's command-line parser treats tokens beginning with - as options and tokens beginning with @ as argument files that contain additional options.

Because Pillow does not normalize the input path to an absolute form, a filename such as -sDEVICE=... or @/tmp/args.txt reaches Ghostscript as a parseable token rather than as a file path. Classification: Command Injection via argument injection, mapped to [CWE-78] OS Command Injection.

Root Cause

The root cause is missing path normalization in src/PIL/EpsImagePlugin.py. The code uses fp.name directly when the file-like object exposes a name attribute. A relative filename is passed verbatim to the Ghostscript subprocess. Ghostscript's -dSAFER sandbox restricts PostScript operators but does not block option parsing, so argument injection remains possible against hardened invocations.

Attack Vector

Exploitation requires attacker control over the filename supplied to Pillow's EPS pipeline. Two chains are documented. The first injects Ghostscript switches by naming the file with a leading hyphen. The second achieves arbitrary command execution by naming the file with a leading @ and controlling the contents of the referenced argument file. The attack is reachable over the network wherever an application accepts EPS uploads or filenames from untrusted sources.

python
# Security patch in src/PIL/EpsImagePlugin.py
# Source: https://github.com/python-pillow/Pillow/commit/a2c363141da31a265dd536c945677db4b64f3ec9

    infile_temp = None
    if hasattr(fp, "name") and os.path.exists(fp.name):
-       infile = fp.name
+       # Make the path absolute so that a filename beginning with "-" or "@"
+       # can never be interpreted by Ghostscript's argument parser
+       # as an option or an @-file token
+       infile = os.path.abspath(fp.name)
    else:
        in_fd, infile_temp = tempfile.mkstemp()
        os.close(in_fd)

The fix wraps fp.name with os.path.abspath(), guaranteeing a leading / (or drive letter on Windows) so Ghostscript cannot interpret the token as an option or @-file.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-112900

Indicators of Compromise

  • Files on disk or in upload directories whose names begin with - or @, especially with extensions like .eps or .ps
  • gs or ghostscript child processes spawned by Python workers with suspicious argument tokens such as -sDEVICE=, -c, or @/tmp/
  • Unexpected outbound network connections or shell command invocations originating from image processing services

Detection Strategies

  • Inventory running Python environments and flag installations with Pillow versions earlier than 13.0.0
  • Hunt for process creation events where the parent is a web, worker, or batch process and the child command line contains gs -f - or gs -f @
  • Review application logs for EPS upload paths and reject or quarantine filenames containing leading - or @ characters

Monitoring Recommendations

  • Enable process command-line auditing on hosts that render EPS content to capture full Ghostscript invocations
  • Alert on Ghostscript executions that read argument files from writable directories such as /tmp, /var/tmp, or user upload paths
  • Correlate image processing worker activity with subsequent shell, network, or filesystem operations that fall outside its normal baseline

How to Mitigate CVE-2026-112900

Immediate Actions Required

  • Upgrade Pillow to version 13.0.0 or later across all application and container images
  • Audit application code paths that pass user-controlled filenames into PIL.Image.open or EpsImagePlugin
  • Restrict upload directories so attacker-controlled files cannot begin with - or @ by sanitizing or regenerating names at ingestion

Patch Information

The fix is included in Pillow 13.0.0 via commit a2c3631. Details are documented in the GHSA-w889-685w-c8fh advisory and the Pillow 13.0.0 release notes.

Workarounds

  • Normalize uploaded filenames to server-generated identifiers before writing them to disk
  • Reject or rename any file whose basename begins with - or @ prior to invoking Pillow
  • Disable EPS support where unnecessary by removing Ghostscript from the host or by refusing EPS MIME types at the application boundary
bash
# Upgrade Pillow to the fixed release
pip install --upgrade "Pillow>=13.0.0"

# Verify the installed version
python -c "import PIL; print(PIL.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.