Upload2Shell: A Fake PNG Can Wake Up Ghostscript on Your AI Image Server
A file named .png can still wake up a 1980s page renderer. Here is how to check your ComfyUI, Gradio or A1111 box in ten minutes.
The upload box on a self-hosted AI image tool looks like the most boring part of the app. You drag in a picture, the model does its thing, and the interesting work happens somewhere on a GPU.
The upload box is also the one part of the app that reads files written by strangers.
This week a disclosure called Upload2Shell showed how far that boring path can reach. The bug lives in Ghostscript, a decades-old program that draws PostScript and PDF pages. It does not live in any AI tool. But the researcher's own table lists Gradio, InvokeAI, AUTOMATIC1111 and ComfyUI, because their upload and preview code can end up handing a file to Ghostscript without anyone on the team ever choosing Ghostscript.
The result: a file that says it is a PNG can be a small program, and the machine that "looks at" it may run that program.
The quickest check is one command, which gs, and it takes seconds. Below is what actually happened, why AI image servers are in the blast radius, and the short list of checks that close the gap.
What Upload2Shell is, in plain terms
Ghostscript is the renderer behind a lot of "turn this document into an image" work on Linux: print servers, PDF thumbnails, mail previews. PostScript, the language it reads, is a full programming language. A PostScript file is code that happens to draw a page.
Because that is dangerous, Ghostscript has a safety mode called -dSAFER. Think of it as a fence: the page can draw whatever it likes, but it is not supposed to touch files or start other programs.
Upload2Shell (CVE-2026-125396) is a way over that fence. The researcher, Paulos Yibelo of pwn.ai, describes a use-after-free (the program keeps using a piece of memory after it has handed it back) in Ghostscript's Type 1 font loader (the code that reads an old Adobe font format). A crafted document uses it to switch off the fence and then run "attacker-chosen commands as the rendering process." His research write-up, dated November 21, credits the find to "GPT 5.6 Sol, working with @PaulosYibelo," which is its own small sign of the times: an AI model helped find a bug that reaches AI tools.
The fix is not new. Ghostscript 10.08.0, released September 8, closes it, and major distributions shipped patched packages in September and October. The CVE was published November 9, and the evidence page was last updated November 18. It was posted to Hacker News on November 21 and drew well over a hundred points.
So this is not a zero-day. It is a patched bug with a long tail, and the tail is where self-hosted AI tools live.
Why an AI image server is in the blast radius
The research page's most useful finding is about how files reach Ghostscript at all. You might assume a server only runs Ghostscript when someone uploads a PDF. The researcher found otherwise: "files named .png or .jpg can still reach Ghostscript through image conversion."
The common route in Python is Pillow, the image library almost every Python AI tool uses to open pictures. Pillow does not trust file names. It looks at the first bytes of a file to decide what it is. If those bytes say EPS (a PostScript image format), Pillow treats it as EPS, and Pillow's own documentation says that "if Ghostscript is available, other EPS files can be read as well." Reading them means calling Ghostscript.
The researcher traced exactly when that happens. In his test with Pillow 13.0.0, "Image.open() alone only identified the file." Loading the pixels, cropping or converting them "started the renderer." That is precisely what an upload handler or a preview thumbnail does next.
Now look at the AI rows in his evidence table:
- Gradio 6.32.0 is marked "Renderer reached." In a live test, an unauthenticated
gr.Imageapp received "EPS bytes named.png," and "gs -dSAFERstarted before the app function ran." That proves Ghostscript launched from a web upload. It is not a full exploit proof. - InvokeAI, AUTOMATIC1111 and ComfyUI are marked "Source-mapped path." The researcher traced their upload or preview code at pinned source revisions to Pillow calls that load pixels. Nobody ran the exploit against them.
That distinction matters, and it cuts both ways. Nobody has shown command execution on ComfyUI or A1111. But the path from "someone uploads a picture" to "Ghostscript reads it" exists in their code, and the only thing that decides whether it fires is whether Ghostscript is installed on the box.
Plenty of boxes have it. It gets pulled in by ImageMagick, by PDF tools, by document parsers, by a base image someone picked two years ago.
The insight worth keeping: an AI app's attack surface includes every program its libraries are willing to call, not just the code you wrote or installed on purpose. Nobody adds Ghostscript to a ComfyUI server. It arrives as a passenger.
What the confirmed cases look like
To be clear about scale, the researcher records command execution in ten applications, all outside the AI category. They include a Debian 13 print server (CUPS), where an anonymous print job ran commands as the lp user; Roundcube webmail 1.7.2, where viewing a message triggered it through ImageMagick, which hands formats it cannot draw itself to helper programs it calls delegates; MediaWiki with its PDF handler; and WordPress core's renderer. Google mitigated its own exposed path on November 10.
One of those Roundcube attachments was "declared as image/jpeg and named quarterly-results.jpg, but its contents were PostScript." That is the whole trick in one sentence.
A few honest qualifiers belong next to that list. The official severity score (CVSS 4.0) is 8.5 and rates the attack as local, meaning the attacker needs a way to get a file onto the machine, even though the demonstrations reached the renderer remotely through uploads. Several routes need a specific setup, such as a permissive ImageMagick delegate. And the product case studies and full command-execution proofs are marked "Not published." The write-up does include a smaller proof that shows control of Ghostscript's memory without running a shell, so outsiders cannot yet reproduce the full chain. A September teaser also named Box and Zoom, which do not appear in the evidence index.
None of that changes what to do. The patch has existed for over two months.
Put this into practice: a ten-minute check
Run these on every machine or container that accepts uploads: your ComfyUI box, a Gradio demo, an internal document parser, a RAG pipeline that turns PDFs into images.
1. Find out whether Ghostscript is there at all.
which gs && gs --version
If nothing prints, Ghostscript is not on that machine's path, and the Pillow route in this article cannot fire there. You can still have it linked inside another library (the researcher notes Ghostscript "can also be linked into an image-processing build as a library"), so if you use ImageMagick or libvips, keep going.
2. If it is there, check the version and the package.
Upstream 10.08.0 or newer is fixed. Distributions backport the fix into older version numbers, so on Debian and Ubuntu check the package version instead:
dpkg -l ghostscript | tail -1
The research page lists the fixed builds. A few you are likely to meet: Ubuntu 24.04 LTS 10.02.1~dfsg1-0ubuntu7.10, Ubuntu 22.04 LTS 9.55.0~dfsg1-0ubuntu5.15, Debian 13 10.05.1~dfsg-1+deb13u2 or later. As of November 12 the page listed Debian 12 as still vulnerable and Amazon Linux as pending a fix, so check those twice.
3. Rebuild your containers, not just your host.
This is the step people skip. In the researcher's words: "Updating the host operating system does not update a separate copy of Ghostscript inside an existing container image or application bundle." If your ComfyUI runs in Docker, apt upgrade on the host does nothing for it. Rebuild the image from a patched base, then run step 1 inside the container:
docker exec -it <container> sh -c 'which gs && gs --version'
4. If you do not need Ghostscript, remove it.
An image-generation server almost never needs to render PostScript. Removing the package is the cleanest fix, because it closes this bug and the next one in the same program. On Debian or Ubuntu that is apt-get remove ghostscript, then watch what else the package manager wants to remove with it so you know what was pulling it in.
5. If you write the upload code, tell Pillow which formats you accept.
Pillow's Image.open() takes a formats argument that "can be used to restrict the set of formats checked." An app that only wants photos can say so:
from PIL import Image
img = Image.open(upload_path, formats=["PNG", "JPEG", "WEBP"])
img.load()
A file that is secretly EPS now fails to open instead of reaching Ghostscript. The researcher's related advice is about order: "checking a file's real type after generating its thumbnail gives the renderer the first chance to interpret it." Check first, render second.
6. If you use ImageMagick, lock down its delegates.
ImageMagick's security policy page includes a hardened example for public-facing apps with the comment "Disable all external delegates (Ghostscript, ffmpeg, etc.)":
<policy domain="delegate" rights="none" pattern="*"/>
<policy domain="coder" rights="write" pattern="{MVG,PDF,PS,SVG,TXT,XPS}"/>
Run magick identify -list policy to see what is active. One caution: the Upload2Shell pages do not test these lines against this bug, so treat them as general hardening. They also do nothing for Pillow, which calls Ghostscript on its own.
What to expect: on most AI image boxes, step 1 either prints nothing, and you are done, or prints a version that tells you within a minute whether to patch. The slow part is step 3, finding every image that bundles its own copy.
What a sandbox can and cannot do here
It is tempting to say "my app runs in a container, so I'm fine." A container helps. It decides what the hijacked renderer can reach once it is running commands. It does not stop it from running them, and a typical AI box mounts model folders, API keys in environment variables and an output directory full of user work.
The research page points at a better layer: "A policy that prevents a renderer from starting a shell can limit what happens." In the Plesk test, an enforced AppArmor profile blocked the shell. That is a real control, but it was one test on one product, and the deployed endpoint was not tested. Patch first. Treat confinement as the second lock.
Honest limitations
This article cannot tell you that your ComfyUI or A1111 install is exploitable, because nobody has shown that. The researcher's AI rows are source traces, plus one live launch in Gradio. If Ghostscript is absent, the Pillow route described here does not exist on your machine.
The full command-execution exploit is unpublished, and the page does not state an exact range of vulnerable versions. The page's own proof of concept was run against Ghostscript 10.07.0, and its tested targets ranged from 9.54.0 to 10.07.1. When in doubt, read your distribution's advisory for its fixed package rather than guessing from the version number.
The formats fix only protects code you control. If a third-party node, extension or library opens images on its own, it can still take the long way to Ghostscript, which is why removing or patching Ghostscript beats any single code change.
And this is one bug. Ghostscript has had sandbox escapes before, and PostScript will still be a programming language next year.
The upload box is part of your threat model now
The lesson from Upload2Shell is bigger than one CVE. Self-hosted AI tools are built on top of a deep stack of image and document libraries, and those libraries will cheerfully call any helper they find on the machine. Your attack surface is everything installed, not everything you meant to use.
The good news is that this one is cheap to close. One command tells you whether Ghostscript is there. One rebuild puts a patched copy in your containers. One line of Python stops a fake PNG from being treated as a page to draw.
Run which gs on your AI box tonight. Whatever it prints, you will know something about your server you did not know this morning.
Sources: Upload2Shell evidence index, pwn.ai (updated Nov 18, 2026); How We Hacked the Pipes, pwn.ai research write-up (Nov 21, 2026); Pillow EPS format notes; Pillow Image.open reference; ImageMagick security policy; Hacker News discussion.