How a File Upload Becomes a Shell: A Plain-English Guide to Ghostscript’s Upload2Shell Flaw (CVE-2026-125396)

What Ghostscript is, why a PDF or image can carry an attack, and the five checks every team that accepts uploads should run this week
De la part de MAG212 CYBER Daily, 23 November 2026. This article was written with AI assistance and edited by El Mostafa Ouchen. Commands, where included, are generic and were non testé par MAG212; run them only on systems you are authorised to administer.

What you will learn
- What Ghostscript is and why so many apps run it without you noticing
- What a “use-after-free” and a “sandbox escape” mean, in plain words
- How researchers turned one bug into a shell through uploads, email previews and printers
- How to check whether you are exposed, and what to fix first
The short version
Researchers at pwn.ai published a write-up on 21 November 2026 called “Upload2Shell”. It describes CVE-2026-125396, a memory bug in Ghostscript’s Type 1 font loader. A crafted file can use it to switch off Ghostscript’s safety sandbox (the -dSAFER mode) and then run commands on the server. The flaw is fixed in Ghostscript 10.08.0, released on 8 September 2026. pwn.ai
The public proof of concept only changes memory; it does not run shell commands. No exploitation in the wild has been reported, and the flaw is not in CISA’s Known Exploited Vulnerabilities list as of 23 November. That is the good news. The bad news is that several enterprise Linux distributions were still unpatched in mid-November. Les actualités des hackers, iTnews
Lesson 1: Ghostscript is everywhere, and usually invisible
Ghostscript is an interpreter for PostScript and PDF. You may never run it yourself, but lots of software calls it behind the scenes whenever it needs to turn a PDF, EPS or PostScript file into an image: to draw a thumbnail, show a preview, convert a document or prepare a print job.
The pwn.ai team listed paths through webmail (Roundcube builds a thumbnail when a message is viewed, so no click on the attachment is needed), WordPress uploads, form plugins that accept PDFs, wikis and document managers, a Debian print server, and Python and PHP imaging libraries such as Pillow and Imagick. They also say they sent a harmless proof to Google services, which closed that path on 10 November. pwn.ai
The lesson: your attack surface includes every library your app loads, not only the code you wrote. If your product accepts a file and shows a preview, ask what draws that preview.
Lesson 2: Two terms worth understanding
Sandbox (-dSAFER). PostScript is a full programming language, so a “document” is really a small program. Ghostscript’s SAFER mode is meant to stop that program from opening or writing arbitrary files. Apps rely on it to handle untrusted files safely.
Use-after-free. A program frees a piece of memory but keeps a pointer to it. If an attacker can get new data placed in that freed spot, the program later trusts data the attacker controls. According to pwn.ai, a privileged helper inside Ghostscript could be tricked into leaving such a dangling reference; the researchers turned it into the ability to write to memory, used that to switch off the SAFER file check, and then ran commands. pwn.ai
Artifex developer Ken Sharp described the step involved as old code that is known to be risky and hard to remove; Artifex is moving it into safer code. Les actualités des hackers
The lesson: a sandbox inside a process is one layer, not a wall. If the process itself is compromised, the sandbox can be switched off from the inside.
Lesson 3: “Local” in a score does not mean “safe from the internet”
The flaw carries a CVSS 4.0 score of 8.5 with a local attack vector. Yet every path the researchers showed was reachable remotely: an upload form, an email, a shared print queue. pwn.ai
The lesson (MAG212 analysis): if your patch queue is sorted only by CVSS vector, this one may sit lower than it should. Ask how attacker-controlled files reach the vulnerable component, not just what the score says.
Lesson 4: Version numbers can lie
Distributions often backport fixes and keep the old version string, so gs --version alone can mislead you in both directions, iTnews warns. iTnews
In pwn.ai’s snapshot from 11–12 November:
- Fixed: Debian 13 (DSA-6516-1), Ubuntu (USN-8949-1), and 10.08.0 in Arch, Fedora Rawhide, Alpine, openSUSE Tumbleweed and Homebrew.
- Still open: Debian 12, Amazon Linux 2 / 2023 (“pending fix”), several SUSE Enterprise lines and openSUSE Leap 16.
- Not checked by the researchers: RHEL, Rocky, AlmaLinux, Oracle Linux and stable Fedora.
That snapshot is now more than ten days old, so check your vendor’s tracker for the current status. pwn.ai
Your five-step checklist
- Find every Ghostscript. Hosts, containers, app bundles and appliances. Image libraries often call a bundled or system copy.
- Update to 10.08.0 or your vendor’s backport, then restart the services that load it. Confirm with your distribution’s security tracker rather than the version string alone.
- Lock down print queues. Require authentication on shared IPP/CUPS queues and keep them off untrusted networks.
- Check file types before you render. Validate the real file type (not the extension) before you generate a preview or thumbnail, and refuse PostScript and EPS where you do not need them.
- Confine the renderer. Run conversion in a separate, unprivileged process or container that cannot start a shell. In one test, an AppArmor profile blocked the shell. Do not rely on
-dSAFERalone. pwn.ai
WordPress site owners: WordPress 7.0.4 (and 6.9.7 with backports) closed WordPress’s own upload path, which was tracked separately as CVE-2026-65640. That fix does not replace updating Ghostscript on the server. Les actualités des hackers
A read-only starting point for an inventory (generic, non testé par MAG212; run it only on systems you administer):
gs --version
dpkg -l | grep -i ghostscript # Debian/Ubuntu
rpm -qa | grep -i ghostscript # RHEL/SUSE/Amazon Linux
Do not confuse it with CVE-2026-39919
A different Ghostscript heap overflow, CVE-2026-39919, was reported in October. It affects 9.21 to 10.07.1 and is also fixed in 10.08.0. Same fix, different bug. BleepingComputer
Points clés à retenir
- A file is input to a program, and sometimes it is a program.
- Inventory the libraries behind your previews, not just your own code.
- Patch to 10.08.0 or a verified backport, and confine the renderer as a second layer.
- Treat “local” CVSS scores with care when files arrive from the internet.
Sujets connexes sur MAG212 CYBER
- MAG212 CYBER Daily, 23 November 2026: One upload, one shell (numéro complet et PDF)
- Where do your AI prompts really go?
- No malware needed: Webworm’s VPN spy bridge
- CISA’s KEV list explained
- Abonnez-vous gratuitement à MAG212 CYBER
Sources
- pwn.ai: pwn.ai
- The Hacker News: thehackernews.com
- iTnews: www.itnews.com.au
- BleepingComputer: www.bleepingcomputer.com
Written and edited by El Mostafa Ouchen for MAG212 CYBER. Facts checked against the sources above as of 23 November 2026, 7:00 AM PT.
