Upload2Shell: When a JPEG Becomes a Shell
Most web applications treat an upload box as a place to put a file. The operating system treats it as a place to run a parser. That gap is the story behind Upload2Shell, a Ghostscript sandbox escape tracked as CVE-2026-125396. A crafted document can cross Ghostscript’s -dSAFER boundary and execute commands as the user that renders it — often the web server, the mail server, or the print service.
The bug is not a remote buffer overflow in a web server. It is a flaw in a document interpreter that sits behind thumbnails, previews, print queues, and media libraries. That is why the same CVE shows up in WordPress, Roundcube, MediaWiki, CUPS, and ImageMagick pipelines. One vulnerable component; many front doors.
What CVE-2026-125396 actually is
Ghostscript before 10.08.0 contains a -dSAFER bypass in the .putgstringcopy procedure in gs_fonts.ps. The procedure calls the privileged .forceput operator without checking the types of its operands. A crafted PostScript or PDF file can trigger a type error, recover .forceput through a custom error handler, and cause a use-after-free across save/restore. The result is native read/write and controlled dispatch — in practical terms, code execution in the renderer’s security context.
Artifex’s fix commit is blunt about the class of bug: it is “effectively another case of recovering .forceput” by causing an error and having the error handler use it. The patch validates the operands so the error path cannot execute copy and reach .forceput.
NVD scores it 7.8 on CVSS 3.1 and 8.5 on CVSS 4.0. The CVSS 3.1 vector is AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H — local attack vector, low complexity, no privileges, user interaction required. That “local” label is technically correct and operationally misleading. The file does not need to be opened on the server by a local user; it needs to reach a service that hands it to Ghostscript. Upload forms, mail previews, and print queues do exactly that.
The chain: upload, preview, print
The research, published by Paulos Yibelo and pwn.ai on 21 November 2026, demonstrates three delivery paths:
- Web upload. An attacker uploads a document that looks like an image or PDF. The application calls ImageMagick, which calls Ghostscript to render or thumbnail it. The malicious PostScript reaches the vulnerable interpreter during routine processing.
- Email preview. A mail client or webmail generates a thumbnail for an attachment. In the Roundcube test, simply viewing the message caused the attachment to be processed — no click on the attachment was required. The command ran as the webmail user.
- Print queue. A print service accepts a document and passes it to a Ghostscript-based filter. The researchers demonstrated command execution on a CUPS print server running on Debian 13, with the command running as the print renderer’s account rather than the person who submitted the job.
The common pattern is not a missing file-extension check. It is an application trusting a renderer with attacker-controlled input. A file named quarterly-results.jpg can contain PostScript; the renderer may identify it by magic bytes, not by the extension. Blocking .ps uploads is not a fix.
Which applications are exposed?
The researchers confirmed command execution in several common stacks, including WordPress media and plugin upload forms, Roundcube webmail, MediaWiki, and CUPS on Debian 13.
Two application-level fixes matter, but they are not the same as the Ghostscript fix:
- WordPress 7.0.4 (12 August 2026) fixed WordPress’s own author-level ImageMagick/Ghostscript upload path under CVE-2026-65640. The fix was backported to older branches. It does not upgrade the Ghostscript binary on the host.
- Roundcube 1.6.20 / 1.7.5 fixed unsafe image handling under CVE-2026-114727. Older Roundcube versions can pass SVG and EPS into ImageMagick during image resizing. Again, the application patch reduces exposure; it does not make a vulnerable Ghostscript safe.
This is the part that gets lost in “patch WordPress” advice. If the server still has Ghostscript 10.07.1 or earlier, another upload path, plugin, mail preview, or print filter can reach it. The durable fix is the interpreter update.
What is patched, and what to check
Upstream Ghostscript 10.08.0 was released on 8 September 2026 and contains the fix. The CVE record was published on 9 November (NVD followed on 10 November); the public technical writeup followed on 21 November.
Check the actual binary, not the package name:
gs --version
# vulnerable if lower than 10.08.0
On Debian and Ubuntu, check the distribution’s security tracker and installed package version. Debian 13 has a fixed package; confirm the version with the Debian security tracker. Ubuntu’s tracker still listed CVE-2026-125396 as “needs evaluation” on 18 November, so do not assume a base image is patched. Containers are a particular trap: updating the host does not update the Ghostscript inside the container image.
For WordPress, update core to 7.0.4 or the patched release for your branch, then update the Ghostscript package in the underlying PHP/Imagick environment. For Roundcube, update to 1.6.20 or 1.7.5, then update Ghostscript. For CUPS and other print services, update the renderer and restart the service. If you cannot patch immediately, remove Ghostscript from the processing path for untrusted files, or restrict upload and preview features to trusted users.
How bad is it in the wild?
As of 22 November 2026, NVD’s SSVC assessment lists exploitation as none, and there is no confirmed widespread exploitation campaign. That is not a reason to wait. The exploit is deterministic enough to be demonstrated across multiple applications, the patch is public, and the vulnerable component is common. “No known exploitation” means “not observed yet”, not “not attempted”.
The more useful takeaway is architectural. Every service that renders user-supplied documents has a parser chain behind it: application, image library, document interpreter, font engine. Each layer is a potential trust boundary. Upload2Shell is a reminder that the scariest file is not the one that looks executable. It is the one that looks like a JPEG and is processed by something that speaks PostScript.
Sources
- pwn.ai, “How We Hacked the Pipes — Upload2Shell”, 21 November 2026: pwn.ai
- NVD, CVE-2026-125396: nvd.nist.gov
- Artifex Ghostscript fix commit, “PS interpreter – validate operands to .putgstringcopy”: github.com
- Ghostscript releases, 10.08.0 (2026-09-08): ghostscript.com
- oss-sec, “Ghostscript 10.08.0 fixes multiple CVEs, including upload2shell”: seclists.org
- Debian Security Tracker, CVE-2026-125396: security-tracker.debian.org
- WordPress 7.0.4 release and CVE-2026-65640: wordpress.org
- Roundcube CVE-2026-114727: cve.org
- Ubuntu CVE-2026-125396: ubuntu.com
Disclosure: the author has no access to the vulnerable systems described. The commands above are verification steps, not exploitation instructions.
