Skip to content
CVE-2026-112900 Elastic Security · Elastic

Detect Pillow EpsImagePlugin Ghostscript Argument Injection (CVE-2026-112900) in Elastic Security

Detects exploitation of CVE-2026-112900, an argument injection vulnerability (CWE-78/CWE-88) in the Python Pillow imaging library (>= 2.6.0, < 13.0.0). When Pillow's EpsImagePlugin processes an EPS file, it invokes the external Ghostscript binary (gs) and passes an attacker-influenced input filename after -f without converting it to a safe absolute path. A filename beginning with a hyphen is read by Ghostscript as an option, allowing command-line argument injection. A filename beginning with @ causes Ghostscript to read additional arguments from the named file; if the attacker also controls that file, the chain can be escalated to arbitrary command execution. The issue reproduces under Pillow's default -dSAFER invocation and is fixed in Pillow 13.0.0. This detection surfaces anomalous Ghostscript process executions spawned from Python or web-application processes with suspicious argument patterns, as well as EPS processing by vulnerable Pillow versions.

Based on GHSA-w889-685w-c8fh, Pillow EpsImagePlugin Ghostscript argument injection

MITRE ATT&CK

Tactic
Initial Access Execution

Elastic Detection Query

Elastic Security (Elastic)
eql
// df00tech DF00-30e675dc04 · https://df00tech.com/detections/CVE-2026-112900 · licence: https://df00tech.com/detections/licence
process where event.type == "start" and
  process.name in ("gs", "gs.exe", "gswin32c.exe", "gswin64c.exe") and
  process.parent.name in ("python", "python3", "python.exe", "gunicorn", "uwsgi", "celery", "node", "w3wp.exe") and
  (
    process.command_line : ("*-sOutputFile=%pipe%*", "*-sOutputFile=|*", "*-dNOSAFER*", "*-dDELAYSAFER*", "*-sOutputFile=/tmp/*", "*-sOutputFile=/dev/*", "*../*") or
    process.args : "-c"
  )
high severity medium confidence

EQL rule matching Ghostscript process starts parented by Python or web-application runtimes with argument-injection indicators such as pipe output, disabled sandbox, path traversal, or inline PostScript execution.

Data Sources

Elastic DefendWinlogbeat SysmonAuditbeat

Required Tables

logs-endpoint.events.process-*winlogbeat-*

False Positives & Tuning

  • Document conversion services legitimately spawning Ghostscript from Python
  • PDF/EPS rendering batch jobs with standard safe options
  • Pillow test-suite executions on development hosts

Other platforms for CVE-2026-112900


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 Simulate Pillow EPS processing invoking Ghostscript with injected output pipe

    Expected signal: Process-creation event: gs spawned by python3 with command line containing -sOutputFile=%pipe% and -c.

  2. Test 2 Simulate Ghostscript invocation with disabled sandbox (-dNOSAFER)

    Expected signal: Process-creation event: gs spawned by python3 with -dNOSAFER on the command line.

  3. Test 3 Process a crafted EPS file through a vulnerable Pillow version

    Expected signal: python3 process loads EPS and spawns a gs child process to render it.


Response Playbook

Triage

  1. Confirm the Ghostscript (gs) invocation was spawned by an application process (Python/web server) rather than an interactive user, and capture the full command line for injected arguments (-dNOSAFER, -sOutputFile=%pipe%, -c, path traversal).
  2. Identify the EPS/image file that triggered the invocation, correlate the parent process with recent file uploads or image-processing requests in application and web-server logs.
  3. Determine the installed Pillow version in the affected application environment (pip show Pillow / requirements lockfile); versions >= 2.6.0 and < 13.0.0 are vulnerable.
  4. Check whether Ghostscript's output or child processes attempted file reads/writes outside expected directories or network connections, indicating successful injection.

Containment

  1. Isolate or restrict the affected host/service and temporarily disable EPS/PostScript image processing in the application (e.g. reject EPS uploads at the ingress).
  2. Upgrade Pillow to >= 13.0.0 in the affected environment, or pin Ghostscript invocation behind -dSAFER and restrict its filesystem access.

Evidence Collection

  1. Preserve the suspicious EPS file, the full Ghostscript command line, and process-tree telemetry (parent/child PIDs, user context, timestamps).
  2. Collect application and web-server access logs around the event, including upload metadata, source IP, and session identifiers.

Escalation Criteria

  • !Escalate to incident response if Ghostscript executed inline PostScript (-c), wrote to pipes/arbitrary paths, or if subsequent reverse-shell, outbound C2, or file-exfiltration activity is observed.
  • !Escalate if the affected service is internet-facing and accepts untrusted image uploads, indicating active exploitation of this critical (CVSS 9.8) code-execution path.

Investigation Guide

Forensic Artifacts

  • >Malicious EPS file on disk or in application upload storage/temp directories
  • >Process-creation records showing gs child of a Python/web-server parent with injected arguments
  • >Ghostscript-created output files, pipes, or unexpected files in temp/web directories

Tuning Guidance

Baseline legitimate Ghostscript-from-Python invocations in your environment (document/PDF conversion, thumbnailing) and allowlist their known command-line shapes and parent services. Tighten the metacharacter/path-traversal regex to your actual output directories. If EPS processing is not used by any application, alert on ANY gs child of an application runtime regardless of arguments.


Hunting Queries

Hunt for Ghostscript executions spawned by Python with unsafe/injected arguments across the fleet.

Hunting — KQL
kql
// df00tech DF00-30e675dc04 · https://df00tech.com/detections/CVE-2026-112900 · licence: https://df00tech.com/detections/licence
DeviceProcessEvents | where FileName in~ ("gs","gs.exe","gswin64c.exe") | where InitiatingProcessFileName has "python" | where ProcessCommandLine has_any ("-dNOSAFER","%pipe%","-c ") | project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessCommandLine
Hunting — SPL
spl
``` df00tech DF00-30e675dc04 · https://df00tech.com/detections/CVE-2026-112900 · licence: https://df00tech.com/detections/licence ```
index=* EventCode=1 (process_name=gs OR process_name=gswin64c.exe) parent_process_name=python* | search process="*-dNOSAFER*" OR process="*%pipe%*" OR process="*-c *" | table _time host process parent_process_name

Atomic Red Team Tests

Test 1 Simulate Pillow EPS processing invoking Ghostscript with injected output pipe
linux

Invokes Ghostscript the way Pillow would but with an injected -sOutputFile=%pipe% argument to generate the detection telemetry in a lab.

Command

bash
python3 -c "import subprocess; subprocess.run(['gs','-q','-dNOPAUSE','-dBATCH','-sDEVICE=ppmraw','-sOutputFile=%pipe%id','-c','quit'])"

Cleanup

bash
rm -f /tmp/eps_poc_out* 2>/dev/null; true

Expected Telemetry

Process-creation event: gs spawned by python3 with command line containing -sOutputFile=%pipe% and -c.

Expected Detection

KQL/SPL/EQL rules match on gs child of python with %pipe% and -c indicators.

Test 2 Simulate Ghostscript invocation with disabled sandbox (-dNOSAFER)
linux

Launches Ghostscript from a Python parent with -dNOSAFER to emulate argument injection disabling the sandbox.

Command

bash
python3 -c "import subprocess; subprocess.run(['gs','-dNOSAFER','-dNOPAUSE','-dBATCH','-sDEVICE=nullpage','-c','quit'])"

Cleanup

bash
true

Expected Telemetry

Process-creation event: gs spawned by python3 with -dNOSAFER on the command line.

Expected Detection

Rules match on gs child of python with -dNOSAFER indicator.

Test 3 Process a crafted EPS file through a vulnerable Pillow version
linux

Creates a minimal EPS and opens it with Pillow to trigger the EpsImagePlugin Ghostscript invocation (run only on a disposable lab host with a vulnerable Pillow < 13.0.0).

Command

bash
python3 -c "from PIL import Image; open('/tmp/poc.eps','w').write('%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 100 100\nshowpage\n'); Image.open('/tmp/poc.eps').load()"

Cleanup

bash
rm -f /tmp/poc.eps 2>/dev/null; true

Expected Telemetry

python3 process loads EPS and spawns a gs child process to render it.

Expected Detection

Rules flag the gs process spawned by python3 during EPS rendering.

Related Detections