/

CVE-2026-112900

Severity:

CRITICAL RISK

(9.8)

Argument Injection (CWE-88) in Pillow EPS Handler Plugin

CVE-2026-112900

Analyzed

Vulnerability type

Category:

Argument Injection

CWE:

CWE-78, CWE-88

Impact:

Arbitrary Command Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Pillow's EPS processing can pass a caller-controlled filename to Ghostscript in a way that allows the filename to be interpreted as a Ghostscript option. An attacker who controls the filename, and in the command-execution scenario also controls a referenced argument file, may achieve arbitrary command execution when the EPS input is processed.

Pillow's EPS processing can pass a caller-controlled filename to Ghostscript in a way that allows the filename to be interpreted as a Ghostscript option. An attacker who controls the filename, and in the command-execution scenario also controls a referenced argument file, may achieve arbitrary command execution when the EPS input is processed.

Affected context

The issue affects Pillow deployments that process EPS images through EpsImagePlugin.Ghostscript and pass filenames influenced by an attacker or another untrusted source. It is relevant when the supplied filename begins with a hyphen and is forwarded to Ghostscript without being converted into a safe absolute path or otherwise separated from command-line options. The full command-execution chain additionally depends on an attacker-controlled @ argument-file reference and control of the referenced text file.

The issue affects Pillow deployments that process EPS images through EpsImagePlugin.Ghostscript and pass filenames influenced by an attacker or another untrusted source. It is relevant when the supplied filename begins with a hyphen and is forwarded to Ghostscript without being converted into a safe absolute path or otherwise separated from command-line options. The full command-execution chain additionally depends on an attacker-controlled @ argument-file reference and control of the referenced text file.

Exploit preconditions

  • Attack surface: EPS image processing through Pillow and its Ghostscript integration
  • Required access: Ability to control or influence the input filename; arbitrary command execution additionally requires control of a referenced Ghostscript argument file
  • Trigger point: Invocation of Ghostscript while Pillow processes the EPS input
  • Why exploitation is possible: The filename is placed after -f without reliable option termination or safe path normalization, allowing a hyphen-prefixed name to be interpreted as a Ghostscript argument
  • Attack surface: EPS image processing through Pillow and its Ghostscript integration
  • Required access: Ability to control or influence the input filename; arbitrary command execution additionally requires control of a referenced Ghostscript argument file
  • Trigger point: Invocation of Ghostscript while Pillow processes the EPS input
  • Why exploitation is possible: The filename is placed after -f without reliable option termination or safe path normalization, allowing a hyphen-prefixed name to be interpreted as a Ghostscript argument

Why this happens

The vulnerable pattern passes caller-controlled filename data into a command-line interface without ensuring that the value is treated strictly as a file operand. A filename beginning with a hyphen can therefore alter Ghostscript's argument parsing, which maps to CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection'). In the reported command-execution chain, an injected @ argument causes Ghostscript to read additional options from an attacker-controlled text file, linking the issue to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The vulnerable pattern passes caller-controlled filename data into a command-line interface without ensuring that the value is treated strictly as a file operand. A filename beginning with a hyphen can therefore alter Ghostscript's argument parsing, which maps to CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection'). In the reported command-execution chain, an injected @ argument causes Ghostscript to read additional options from an attacker-controlled text file, linking the issue to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Potential impact

  • An attacker may alter Ghostscript processing options.
  • Arbitrary commands could execute in the application process context when the required argument-file conditions are met.
  • Sensitive files or imaging-service data could be exposed or modified.
  • The host or service account could be compromised.
  • Downstream image-processing workflows may be disrupted or used for lateral movement.
  • An attacker may alter Ghostscript processing options.
  • Arbitrary commands could execute in the application process context when the required argument-file conditions are met.
  • Sensitive files or imaging-service data could be exposed or modified.
  • The host or service account could be compromised.
  • Downstream image-processing workflows may be disrupted or used for lateral movement.

General mitigation guidance

Mitigation generally focuses on ensuring that data-derived filenames cannot be interpreted as command-line options.

Common defensive patterns include:

  • Passing validated, canonical absolute paths to subprocess interfaces.
  • Using argument-vector APIs rather than shell command construction.
  • Applying explicit option termination where supported and treating filenames strictly as operands.
  • Restricting EPS processing and avoiding attacker-controlled filenames or argument files where possible.
  • Running Ghostscript and image-processing workers with least privilege and suitable filesystem, network, and process isolation.
  • Applying allowlists for supported image formats and enforcing resource and execution policies for untrusted documents.

Mitigation generally focuses on ensuring that data-derived filenames cannot be interpreted as command-line options.

Common defensive patterns include:

  • Passing validated, canonical absolute paths to subprocess interfaces.
  • Using argument-vector APIs rather than shell command construction.
  • Applying explicit option termination where supported and treating filenames strictly as operands.
  • Restricting EPS processing and avoiding attacker-controlled filenames or argument files where possible.
  • Running Ghostscript and image-processing workers with least privilege and suitable filesystem, network, and process isolation.
  • Applying allowlists for supported image formats and enforcing resource and execution policies for untrusted documents.

How teams detect issues like this

Organizations can detect related risks through:

  • Static analysis rules for subprocess calls that combine user-controlled filenames with command arguments.
  • Code review checks for missing option termination, path canonicalization, or operand validation.
  • Tests using filenames beginning with hyphens and other option-like forms to verify they remain data.
  • Runtime monitoring for unexpected Ghostscript arguments, @ argument-file usage, or child-process creation during image conversion.
  • Policy enforcement that restricts EPS processing, Ghostscript capabilities, and execution privileges in isolated workers.
  • Automated security review tools that identify command and argument injection patterns.

Organizations can detect related risks through:

  • Static analysis rules for subprocess calls that combine user-controlled filenames with command arguments.
  • Code review checks for missing option termination, path canonicalization, or operand validation.
  • Tests using filenames beginning with hyphens and other option-like forms to verify they remain data.
  • Runtime monitoring for unexpected Ghostscript arguments, @ argument-file usage, or child-process creation during image conversion.
  • Policy enforcement that restricts EPS processing, Ghostscript capabilities, and execution privileges in isolated workers.
  • Automated security review tools that identify command and argument injection patterns.

Sources

SourceLink
github.comgithub.com/python-pillow/Pillow/commit/a2c363141da31a265dd536c945677db4b64f3ec9
github.comgithub.com/python-pillow/Pillow/releases/tag/13.0.0
github.comgithub.com/python-pillow/Pillow/security/advisories/GHSA-w889-685w-c8fh

Frequently asked

questions

It can be exploitable through an application that processes attacker-supplied EPS content or filenames. Exploitability depends on how the application obtains and handles those values.

The attacker must control or influence the filename passed to Pillow. Achieving arbitrary command execution additionally requires control of a referenced @ argument file containing Ghostscript arguments.

Treat filenames as data rather than command-line options by using validated absolute paths, safe argument-vector APIs, and explicit option separation where supported.

Limit untrusted EPS processing, test option-like filenames, apply least privilege and sandboxing, and enforce code-review or automated-analysis policies for subprocess argument construction.

It can be exploitable through an application that processes attacker-supplied EPS content or filenames. Exploitability depends on how the application obtains and handles those values.

The attacker must control or influence the filename passed to Pillow. Achieving arbitrary command execution additionally requires control of a referenced @ argument file containing Ghostscript arguments.

Treat filenames as data rather than command-line options by using validated absolute paths, safe argument-vector APIs, and explicit option separation where supported.

Limit untrusted EPS processing, test option-like filenames, apply least privilege and sandboxing, and enforce code-review or automated-analysis policies for subprocess argument construction.

Find out what's already
exploitable in your codebase.