A PDF or image upload can run code on your server through Ghostscript. Follow one file through your app tonight
Someone uploads a PDF and your app makes a preview. If an old Ghostscript sits behind that preview, a crafted file can run commands on your server. Here's how to trace one file, check your copy and patch it tonight.

You're exposed if Ghostscript older than 10.08.0, or an unpatched distribution build, sits where your app turns uploads or attachments into previews and outsiders can send it files. Patch the copy inside every image and worker tonight. Where you can't, block PostScript and PDF in ImageMagick's policy.
Picture one file arriving
Somebody fills in a form on your site and attaches a PDF. Maybe it's a résumé, an invoice or a signed lease. Your app saves it, and a moment later it makes a small preview of the first page so your team can see what came in.
That preview step is where this week's Ghostscript problem lives.
Ghostscript is the program a lot of software quietly hands PDF and PostScript files to when it needs to turn them into pictures. It runs those files in a safety mode called -dSAFER, which is supposed to stop a document from reading files or running commands. CVE-2026-125396, which the researchers at pwn.ai call Upload2Shell, is a way out of that safety mode. In Ghostscript before 10.08.0, a crafted PostScript or PDF file can trip a memory bug in the font loader and run commands as whatever account is doing the rendering. On a web server, that's usually the account your app runs as.
A few things to hold onto:
- The fix isn't new. Artifex shipped Ghostscript 10.08.0 on September 8. The CVE was published on November 9, pwn.ai's full write-up followed on November 17, and the story took off on X this afternoon. The question tonight isn't whether a fix exists. It's whether your copy has it.
- The name on the file doesn't protect you. pwn.ai reached Ghostscript with files named
.jpgand.pngwhose contents were PostScript. Image libraries look at the bytes, not the extension. - The confirmed routes are ordinary features. Viewing an email in Roundcube made the server thumbnail an attachment, no click needed. Public upload fields on WordPress sites, through the Forminator and Essential Addons for Elementor plugins, worked without a login. So did a shared print queue on Debian 13, anonymous PDF uploads on a MediaWiki set up to allow them, and an email inbox feeding the Mayan EDMS document system. Google closed a route through its own document pipeline on November 10.
- No known attacks yet, but a proof is public. CISA's November 10 assessment recorded no known exploitation. pwn.ai has published a proof file that shows control of Ghostscript's memory, though not the full command-running chain.
Credit goes to Paulos Yibelo and pwn.ai, who say an AI model working with Yibelo found the bug, and to Ken Sharp at Artifex, who wrote the fix. The score is 8.5 on CVSS 4.0 with a "local" attack vector. Don't let that word settle you: uploads, attachments and print jobs carry the file in from far away.
Follow it to the step that draws it
Storing a file is harmless. In pwn.ai's tests, copying or saving an upload never started Ghostscript. The trouble starts with whatever happens next: a thumbnail, a preview, a resize, reading the image size, a PDF/A conversion, an imported attachment, a print job. So walk one upload forward until something tries to draw it, then ask which library does the drawing and whether it hands the file to Ghostscript.
From pwn.ai's tests and the libraries' own documentation, the usual suspects are these:
- ImageMagick, through any wrapper. PHP's Imagick, Ruby's MiniMagick (which Rails Active Storage and CarrierWave can both use), Python's Wand. ImageMagick picks a reader from the file's contents and passes PostScript and PDF to Ghostscript.
- Python's Pillow, and things built on it. Opening a file only identifies it. Loading the pixels, cropping or making a thumbnail of EPS content started Ghostscript, including through imageio and scikit-image.
- libvips, sometimes. It depends on how it was built. The system build pwn.ai tested routed the file to ImageMagick and then Ghostscript.
- Tools that call Ghostscript directly. Paperless-ngx uses it for PDF/A conversion. The Node package pdf2pic lists GraphicsMagick and Ghostscript as requirements.
Some didn't reach Ghostscript in pwn.ai's tests: PHP's GD, OpenCV, prebuilt Sharp, Jimp, Java ImageIO and Go's standard image decoders. Python's pdf2image uses Poppler instead. Rails' built-in PDF previewers call Poppler's pdftoppm or MuPDF's mutool, not Ghostscript. Rails does still run uploaded images through ImageMagick or libvips to read their size and make variants, so a Rails app isn't off the hook just because its PDF previews are fine.
Include files that arrive without an upload button: an inbox that imports attachments, a help desk that previews them, a print server on the office network. Same question each time: what draws it?
How the work moves
Where an upload meets Ghostscript
- It arrives
An upload form, an emailed attachment, an API call or a print job. The file name can say .jpg.
- It's stored
Copying or saving the file didn't start Ghostscript in pwn.ai's tests.
- Something draws it
A thumbnail, preview, resize, size check, PDF/A conversion or document import.
- A library picks a reader
ImageMagick wrappers, Pillow, some libvips builds, or a tool that calls gs itself.
- Ghostscript runs it
Before 10.08.0, a crafted file can leave -dSAFER and run commands as that account.
Storing a file is harmless. The trouble starts in the step that tries to draw it.
The ten-minute check
You're after three answers: is Ghostscript installed where files get processed, which version is actually there, and can anything hand it a file from outside.
1. Ask every machine and image directly. Run this on each server, and inside each container image, that touches uploaded or emailed files. Background worker images count, and they're often built from a different Dockerfile than the web app.
```
command -v gs && gs --version
dpkg -l | grep -E 'ghostscript|libgs' # Debian, Ubuntu
apk info -v 2>/dev/null | grep ghostscript # Alpine
rpm -q ghostscript # Red Hat family, Amazon Linux
```
For an image, run the same thing in a throwaway container: docker run --rm --entrypoint sh your-image -c 'command -v gs; gs --version'. Patching the host doesn't touch the copy inside an image.
One small comfort from a check we ran tonight: the official ruby:3.4-bookworm, python:3.13-bookworm and node:22-bookworm images ship ImageMagick but not Ghostscript, and their slim versions ship neither. On Debian, Ghostscript is only a recommended extra for ImageMagick, so it usually arrives because your own Dockerfile installs it, or installs ImageMagick without --no-install-recommends.
2. Read the version against your distribution, not just against 10.08.0. Distributions often fix the old version instead of upgrading it, so a number below 10.08.0 can be fine. As of tonight:
- Debian 13:
10.05.1~dfsg-1+deb13u2or later; the current security build is+deb13u3. Debian 12:10.0.0~dfsg-11+deb12u9. Both are on Debian's tracker. - Ubuntu (USN-8949-1, October 21): 24.04
10.02.1~dfsg1-0ubuntu7.10, 22.049.55.0~dfsg1-0ubuntu5.15, 26.0410.06.0~dfsg-3ubuntu1.2. That notice came out before the CVE number existed, so Ubuntu's page for CVE-2026-125396 still says "Needs evaluation." Go by the package version. - Alpine: 3.23 and 3.24 have
10.08.0-r0. 3.22 and older still list10.05.1-r0. - Homebrew: 10.08.0.
- Red Hat, Amazon Linux, SUSE: nothing to point at yet. Red Hat had no public page for this CVE tonight, and pwn.ai reported Amazon Linux as "Pending Fix" and several SUSE lines as in progress on November 12.
3. Read ImageMagick's policy. Where ImageMagick is installed, run magick identify -list policy (or convert -list policy on ImageMagick 6). Debian's and Ubuntu's packaged policy already blocks the PS, EPS, PDF and XPS readers. If yours doesn't, find out who changed it and why. Two of pwn.ai's confirmed chains, Roundcube and DokuWiki, needed a permissive ImageMagick setup to work.
4. Search the code for the libraries above.
```
grep -nE 'mini_magick|rmagick|image_processing|ruby-vips|carrierwave|paperclip' Gemfile.lock
grep -nE '"(gm|imagemagick|pdf2pic|sharp)"' package.json
grep -niE 'pillow|wand|ghostscript|pdf2image|imageio' requirements*.txt poetry.lock
php -m | grep -i imagick
grep -rn 'variant_processor\|previewers' config/
```
Then write one line per feature: what draws the file, whether Ghostscript sits where that happens, and who can send the file. Three yeses means you patch tonight.
Tonight: patch the copy that's running
Work through these in order.
- Update the package to 10.08.0 or your distribution's fixed build, everywhere step 1 found it.
- Rebuild every image that contains it, skipping the build cache for that layer, and redeploy the workers as well as the web app. A fixed image sitting in the registry protects nothing.
- Restart anything that loads Ghostscript as a library. Many setups start a fresh
gsfor each file, but some builds link Ghostscript into the running process. pwn.ai points out that searching only forgscommands misses those. - Check again inside what's running, not the Dockerfile. Same commands, against the live container. Our NGINX note has more on proving the new code is the code that's running.
- Close shared print queues to anonymous jobs if you run CUPS anywhere reachable. pwn.ai's Debian chain needed an open queue, and requiring sign-in blocked it.
Can't patch tonight? Stop ImageMagick from handing files to Ghostscript. The Rails security team published these lines for a separate Active Storage advisory on November 4, and they close this route too. Add them to ImageMagick's system policy.xml:
```
<policy domain="delegate" rights="none" pattern="gs" />
<policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,EPS2,EPS3,EPI,EPSF,EPSI,EPT,EPT2,EPT3,PDF,AI,EPDF,PDFA,POCKETMOD,XPS,PCL}" />
```
The long list is deliberate: several names lead to the same reader, and a rule only matches the name it lists. Expect it to break PDF previews that go through ImageMagick; Poppler's pdftoppm, which Rails uses, is a fallback. Rails apps on activestorage 8.1.4.1 or 8.0.5.2 already get this policy, as long as mini_magick is 5.1 or later.
The policy does nothing for tools that call Ghostscript themselves or go through Pillow. For those, remove Ghostscript from any image that doesn't need it, or switch the feature off until the patch is in.
Decision guide
Tonight's move, by where Ghostscript lives
| Consideration | If you can patch tonight | If you can't patch tonight |
|---|---|---|
| Servers and VMs | Install 10.08.0 or the distribution's fixed build. | Remove Ghostscript where nothing needs it. |
| Container images and workers | Rebuild without cache, redeploy, check inside the running container. | Turn off the preview or import feature that feeds it. |
| ImageMagick | Patch Ghostscript, then keep PS and PDF blocked unless you need them. | Deny the gs delegate and every PS, EPS and PDF coder name in policy.xml. |
| Pillow and direct gs calls | Patch, and restart anything that links Ghostscript in. | Restrict Image.open to the formats you accept, or remove Ghostscript. |
| Print servers | Patch the CUPS host. | Require sign-in on shared queues. |
Next week: give the renderer a smaller room
pwn.ai says it found several other Ghostscript bugs, some still being fixed. So the lasting change isn't the patch. It's deciding what the drawing step can reach when something goes wrong.
- Give conversion its own worker. A separate container that gets the file and returns an image. No app secrets, no database credentials, no cloud keys, no outbound network.
- Run it as an account that can't do much. pwn.ai's commands ran as
www-data, aslpon the print server, and as the app's own user inside a container. Whatever that account can read, the attacker can read. In one Plesk test, an AppArmor profile stopped the shell from starting at all. - Check the real file type before you draw anything. Roundcube's fix blocks unsafe attachment types before ImageMagick sees them. Checking after the thumbnail exists gives the renderer the first go.
- Refuse formats you don't need. If customers upload photos, there's no reason to accept PostScript. Pillow's
Image.opentakes aformatslist for exactly this, and ImageMagick's own guidance is to run it in an isolated container.
Then ask whoever runs your software, inside the company or out. Five questions for Monday:
- Which features render uploaded or emailed files, and with what library?
- Where is Ghostscript installed, and what version is running right now? Not what the Dockerfile says.
- Has anyone changed ImageMagick's
policy.xml, and why? - What can the conversion step read, and can it reach the network?
- Which outside services preview our files (e-signature, OCR, help desk, CRM attachments), and have they said whether they're affected?
If you'd like a second pair of hands
This is the kind of check we run on the apps we build and look after: find every place a file gets drawn, patch the copy that's actually running, and move the risky step somewhere it can't do much damage. If you'd rather not do it alone this weekend, see how we work on web applications or get in touch. Bring your answer to question two. It's the best place to start.
We build alongside the people doing the work.
Bring us the problem you’re thinking about.