Critical Pillow Flaw Lets a Crafted EPS Image Run Commands on Your Server

Pillow, the de facto image-processing library for Python, is at the center of a new critical vulnerability that can turn a seemingly harmless image file into a remote code execution primitive. Tracked as CVE-2026-112900, the flaw affects how the library handles EPS (Encapsulated PostScript) files, and it matters because Pillow sits deep inside countless web applications, data pipelines, and document-processing services.

According to the original report from The Hacker News, an attacker can cause a server to execute operating system commands simply by controlling the name of a file that Pillow is asked to open.

The Root Cause

Pillow does not natively parse PostScript. When it encounters an EPS image, it delegates the job to Ghostscript, a separate program invoked to rasterize the file into pixels the library can work with. The vulnerable code path passes the filename to Ghostscript without validating or sanitizing it first.

That is the entire problem in a nutshell: user-influenced input reaches a command invocation without a check. If an attacker can influence the filename string, they can smuggle additional arguments or shell metacharacters into the Ghostscript call, and from there pivot into arbitrary command execution on the host.

Why This Is More Than a Niche Bug

Pillow is one of the most downloaded packages in the Python ecosystem. It is a transitive dependency of Django image fields, thumbnail generators, OCR pipelines, PDF and document conversion services, and countless internal tools that accept uploads.

The dangerous pattern is everywhere: a user uploads a file, the application saves it and then asks Pillow to open or convert it. In many implementations, the filename is derived from user-supplied metadata rather than being fully controlled by the server. That is precisely the condition this vulnerability needs.

Because the flaw leads to command execution rather than a simple crash or memory disclosure, the impact is potentially severe. A successful exploit could allow an attacker to read files, install persistence, or move laterally within an environment, depending on the privileges of the process handling image conversion. Services that run as root or with broad filesystem access are especially exposed.

Who Is Affected

Any application that uses a vulnerable Pillow release to process EPS files is in scope. If your code path never touches EPS input, the practical risk is much lower, but few teams can confidently assert that no uploaded file will ever be routed through the EPS handler. Content-type checks are frequently spoofable, and file extensions are easy to forge.

Mitigation Guidance

The most direct fix is to upgrade Pillow to a patched release as soon as one is available. In parallel, defenders should consider the following measures:

  • Disable EPS support where it is not needed. If your application only handles PNG, JPEG, WebP, or GIF, restrict accepted formats at the application layer and reject everything else before Pillow is invoked.
  • Never trust client-supplied filenames. Generate server-side names (for example, UUIDs) for uploaded files, and pass only those controlled paths to image-processing routines.
  • Run image conversion in a sandbox. Isolate Ghostscript and Pillow workloads in containers with minimal privileges, no network access, and read-only filesystems where feasible.
  • Audit Ghostscript exposure. Ghostscript has its own long history of security issues. Keeping it patched and restricted is a defense-in-depth requirement, not an optional extra.
  • Monitor for anomalous child processes. Detection should focus on unexpected process trees spawned by web or application servers, particularly invocations of shell interpreters or Ghostscript with unusual arguments.

The Bigger Lesson

This vulnerability is a textbook example of an injection flaw hiding inside a dependency chain. The library itself is not malicious, and the delegated tool is not at fault either. The failure is at the seam between them, where an unvalidated string crosses from application data into a command line.

For security teams, the takeaway is to treat image-processing libraries as part of the attack surface, not as inert utilities. Track advisories for Pillow and Ghostscript, inventory where image conversion happens in your architecture, and assume that at least one upload endpoint will eventually receive a file crafted specifically to exploit the next flaw of this kind.

Organizations should prioritize patching and verify whether their applications accept EPS input at all. In many cases, the simplest and most effective mitigation is to stop accepting a format that most modern applications never needed in the first place.

Source: The Hacker News – Critical Flaw in Python's Popular Pillow Image Library Allows Code Execution via a Crafted Image