JupiteX Get the app
Science & Technology29 Nov 2026 · about 6 min

Django's ImageField Let an EPS Through. Then Pillow Called Ghostscript

The brief

Django’s ImageField accepted the test upload as a valid image even though its contents were EPS, not PNG. The uploaded filename was avatar.png, and its supplied content type was image/png. Django’s form returned valid, while Pillow identified the file as EPS and Django reported application/postscript. This matters because acceptance is not the end of an upload’s journey. The form field opens the upload with Pillow and calls verify(). In this test, that showed Pillow could identify the file; it did not restrict the accepted formats to PNG or reject EPS. The article also found that Django’s available image extensions include eps, and a DRF serializers.ImageField behaved the same way. The filename extension is user-controlled, so it does not establish what the bytes contain. The risk appears when later processing needs actual pixels. Resizing, cropping, or making a thumbnail can cause Pillow to invoke Ghostscript to render EPS content. The article did not call Django’s validation a bug; validation stopped at its documented purpose. It highlights the need to consider what happens after an upload passes validation, especially in thumbnail and avatar-processing steps.

01

What did Django's ImageField accept, and why did that matter for later image processing?

Django’s ImageField accepted the test upload as a valid image even though its contents were EPS, not PNG. The uploaded filename was avatar.png, and its supplied content type was image/png. Django’s form returned valid, while Pillow identified the file as EPS and Django reported application/postscript. This matters because acceptance is not the end of an upload’s journey.

The form field opens the upload with Pillow and calls verify(). In this test, that showed Pillow could identify the file; it did not restrict the accepted formats to PNG or reject EPS. The article also found that Django’s available image extensions include eps, and a DRF serializers.ImageField behaved the same way. The filename extension is user-controlled, so it does not establish what the bytes contain.

The risk appears when later processing needs actual pixels. Resizing, cropping, or making a thumbnail can cause Pillow to invoke Ghostscript to render EPS content. The article did not call Django’s validation a bug; validation stopped at its documented purpose. It highlights the need to consider what happens after an upload passes validation, especially in thumbnail and avatar-processing steps.

02

What is EPS, and why can rendering a PostScript file mean running a program rather than simply decoding an image?

EPS is a document format based on PostScript; the article’s test file was an EPS file containing a simple drawing. The article does not spell out the abbreviation, but EPS is commonly expanded as Encapsulated PostScript. The important point here is that an EPS file can contain PostScript instructions, rather than only a fixed array of image pixels.

PostScript is a full programming language, and Ghostscript renders PostScript and PDF. So rendering an untrusted PostScript document means interpreting a program supplied by the document. In the test, Pillow recognized EPS from the file’s bytes, and a later thumbnail operation needed pixels and caused Ghostscript to be called. The test drawing itself was benign; the article did not run the exploit.

That distinction explains why Upload2Shell mattered. The vulnerability let a crafted document alter Ghostscript’s protections and run commands during rendering. The article describes a test setup that logged Ghostscript’s arguments without executing anything. It also reports that, at publication, there were no reports of Upload2Shell being exploited in the wild.

03

Which Pillow operations caused it to call Ghostscript, and what happened when Ghostscript was missing?

The article distinguishes recognizing a file from rendering it. In the author’s test, Image.open() identified avatar.png as EPS and reported its size, but did not call Ghostscript. The pwn.ai table listed Pillow operations that could reach Ghostscript when a file contained EPS content, even if its name ended in .png.

Those operations included load(), crop(), and thumbnail(). They need image pixels, so Pillow handed the EPS document to Ghostscript for rendering. The author’s benign 10-by-10 EPS test triggered two logged calls when thumbnail() needed pixels: one checking the Ghostscript version and another rendering the file. A fake gs script recorded the arguments and exited, so the exploit was not run.

When Ghostscript was absent, the same rendering attempt raised OSError: Unable to locate Ghostscript on paths. The article presents that error as the desired outcome for this particular test. It also notes that actual rendering is the stage to watch: merely opening the file to identify it did not start Ghostscript, while a later pixel-dependent operation did.

04

What could the Upload2Shell vulnerability let an attacker do, and with whose permissions?

Upload2Shell is a use-after-free in Ghostscript’s Type 1 font loader, published as CVE-2026-125396. A crafted document could turn off Ghostscript’s -dSAFER sandbox and run commands while it was being rendered. The key consequence is command execution, not merely a failure to display an image.

The article traces the flaw to a font-loading helper that made a privileged internal write without first checking operand types. The document could trigger an error, recover that write through its error handler, and preserve a dangling reference across a save/restore. Researchers then changed Ghostscript’s path-control flag in memory and used %pipe% to run a command, even with -dSAFER on the command line.

Any command would run as whatever account was doing the rendering, so its permissions depend on that account. The CVSS 4.0 score was 8.5, with a local attack vector, but researchers reached it remotely through several application paths. The article reports no known in-the-wild exploitation. Artifex fixed the issue in Ghostscript 10.08.0 on September 8.

05

How many applications did the article name as reaching Ghostscript through Pillow?

Six applications appear in the article’s list of affected application paths that reach Ghostscript through Pillow: Gradio, ComfyUI, InvokeAI, Frappe, Home Assistant, and django-filer. The list is presented in the pwn.ai research post about Upload2Shell.

The relevant link is the image-processing path. Pillow can identify EPS content from a file’s bytes, regardless of a misleading filename such as .png. When an operation needs pixels, Pillow can call Ghostscript to render that content. If that rendering reaches a vulnerable Ghostscript version, the path could expose the application to the issue described in the article.

The count is six named applications, not a claim that only six applications could be affected. The article gives other examples of routes to Ghostscript too, including an anonymous CUPS print queue, an email thumbnail, and public upload forms in two WordPress plugins. It says Ghostscript 10.08.0 fixed the vulnerability and reports no known exploitation in the wild at the time.

06

Why didn't naming the upload .png or labeling it image/png stop Pillow from recognizing it as EPS?

A filename and a supplied content-type label did not determine the format Pillow recognized in the article’s test. The upload was named avatar.png and declared as image/png, but its contents were EPS. Pillow’s Image.open() identified the file as EPS and reported a 10-by-10 size.

The bytes are the key mechanism in this example: Pillow recognizes the content, while the name and declared type can be supplied by the uploader. Django’s ImageField accepted the upload, and the cleaned file reported application/postscript. The article also notes that Django’s image-extension list includes eps, but an extension check only examines the attacker-controlled name.

This matters because changing the name or label does not stop later processing from treating EPS bytes as EPS. In the test, Image.open() alone did not call Ghostscript, but thumbnail() needed pixels and did. The article’s broader warning is about what happens after validation: operations such as resizing or cropping may bring the content to Ghostscript.

07

What does Ghostscript's -dSAFER sandbox protect against, and why can memory corruption undermine it?

Ghostscript’s -dSAFER option is its own sandbox. According to the article, checks inside the interpreter are meant to stop a PostScript document from opening files or starting commands. That matters because PostScript is a programming language, so rendering an untrusted document involves interpreting its instructions.

The article stresses that -dSAFER is not a kernel boundary like seccomp. Upload2Shell exploited a use-after-free in Ghostscript’s Type 1 font loader. Researchers used the flaw to change a path-control flag in memory, then run a command through %pipe%, even though -dSAFER remained on the command line.

The core weakness is that memory corruption can undermine protections implemented inside the same interpreter. The article says the commands run with the permissions of the account doing the rendering. Artifex fixed the flaw in Ghostscript 10.08.0 on September 8. At the time the write-up was published, The Hacker News noted no reports of exploitation in the wild.

This brief was written by AI from the original reporting and checked by other models. Names, figures and quotes come from the source; read it for full context.

Read more in the JupiteX app

Pulse is free. New stories every 4 hours, each one broken into the questions that explain it.

Or read more news on the web