TL;DR: last updated 2026-11-23 15:40 UTC
Upload2Shell is the name pwn.ai gave to CVE-2026-125396, a flaw in Ghostscript, the PostScript and PDF interpreter that ImageMagick and Imagick call to read those files. A crafted file escapes Ghostscript’s -dSAFER sandbox and runs code as the user that processes it. On a hosting server, that can be a PostScript file uploaded as an image and turned into a thumbnail, with no login. VulnCheck rates it 8.5 (High) on CVSS 4.0.
cagefsctl --force-update, or users inside CageFS keep the old Ghostscript.Ghostscript 10.08.0 fixes CVE-2026-125396. AlmaLinux and Ubuntu have backported the fix to the older Ghostscript versions that CloudLinux 8 to 10 and CloudLinux for Ubuntu run. On November 21, pwn.ai published a write-up with a proof of concept. It shows a PostScript file, named .png, .jpg, or .pdf, uploaded through a WordPress plugin’s public upload field and passed to Ghostscript when ImageMagick makes a thumbnail. Our engineers ran the public proof on CloudLinux test servers. It takes control of Ghostscript on the current packages, inside CageFS too, and fails on the fixed ones.
Every CloudLinux version is affected until it runs the fixed build.
| CloudLinux version | Ghostscript | Fixed in |
|---|---|---|
| CloudLinux 7 ELS and 7 Hybrid | 9.25 | In preparation |
| CloudLinux 8 | 9.27 | 9.27-20.el8_10.alma.1, AlmaLinux testing |
| CloudLinux 9 | 9.54.0 | 9.54.0-19.el9_8.3.alma.1, AlmaLinux testing |
| CloudLinux 10 | 10.02.1 | 10.02.1-16.el10_2.3.alma.1, AlmaLinux testing |
| CloudLinux for Ubuntu 22.04 | 9.55.0 | 9.55.0~dfsg1-0ubuntu5.15, Ubuntu security updates |
To see which build a server runs, on CloudLinux 7 to 10:
rpm -q ghostscript libgs
On CloudLinux for Ubuntu 22.04:
dpkg-query -W ghostscript
A build older than the one in the table is exposed. On CloudLinux 7 ELS and 7 Hybrid, every current build is.
AlmaLinux has published the fixed ghostscript and libgs packages to its testing repository and asks for help verifying them before it releases them to its stable repositories (AlmaLinux’s announcement). Our engineers installed them on CloudLinux 8, 9, and 10 servers with cPanel and CageFS. The public proof stops working, and PDF and PostScript thumbnails still render.
To install them, add AlmaLinux’s testing repository, update Ghostscript from it, and turn the repository off again:
# CloudLinux 8:
dnf install -y https://repo.almalinux.org/almalinux/8/extras/x86_64/os/Packages/almalinux-release-testing-8-2.el8.noarch.rpm
# CloudLinux 9:
dnf install -y https://repo.almalinux.org/almalinux/9/extras/x86_64/os/Packages/almalinux-release-testing-9-2.el9.noarch.rpm
# CloudLinux 10:
dnf install -y almalinux-release-testing
# All three:
dnf update "ghostscript*" libgs --enablerepo=almalinux-testing
dnf config-manager --disable almalinux-testing
cagefsctl --force-update
The last line matters on CageFS servers. CageFS keeps its own copy of Ghostscript’s files, and without the refresh, users inside CageFS keep the old one. In our tests on CloudLinux 9, a plain cagefsctl --update didn’t refresh it.
No reboot is needed. dnf needs-restarting lists any service still holding the old library.
When AlmaLinux moves the packages to its stable repositories, we’ll update this post.
rpm -q --changelog ghostscript | grep CVE-2026-125396
md5sum /usr/share/ghostscript/Resource/Init/gs_fonts.ps /usr/share/cagefs-skeleton/usr/share/ghostscript/Resource/Init/gs_fonts.ps
The first command prints a "Fix CVE-2026-125396" line. On a CageFS server, the two checksums must match, which shows that CageFS has the fixed file too. Without CageFS, the second file doesn’t exist, so ignore that error.
CloudLinux for Ubuntu 22.04 uses Ubuntu’s own Ghostscript, and Ubuntu’s security update 9.55.0~dfsg1-0ubuntu5.15 already fixes the flaw. Servers on that build or later need nothing. Ubuntu’s changelog for the update doesn’t name CVE-2026-125396, because the fix shipped before the CVE number existed, but it carries the same fix. Our engineers checked it. The public proof works on the previous build and fails on this one, inside CageFS too.
apt-get update && apt-get install --only-upgrade ghostscript libgs9 libgs9-common
cagefsctl --force-update
dpkg-query -W ghostscript
The last command should show 9.55.0~dfsg1-0ubuntu5.15 or later.
A fixed build of Ghostscript 9.25 for CloudLinux 7 ELS, which also covers CloudLinux 7 Hybrid, is in preparation. Until it ships, block Ghostscript in ImageMagick, as described below. We’ll update this post when the build is available.
Until a server can take the fix, you can stop ImageMagick from passing files to Ghostscript, which blocks the upload-and-thumbnail route. Our engineers tested it on CloudLinux 8, 9, and 10 servers with cPanel and CageFS; it hasn’t been tested on CloudLinux 7 yet. Every disguised PostScript, EPS, and PDF test file was blocked, as root and inside CageFS, and PNG and JPEG images still converted.
<policymap> tag. /etc/ImageMagick-*/policy.xml is the system ImageMagick’s, and /opt/alt/alt-ImageMagick/etc/ImageMagick-7/policy.xml is alt-ImageMagick’s, which alt-php’s imagick extension uses.<policy domain="delegate" rights="none" pattern="gs" />
<policy domain="coder" rights="none" pattern="{PS,PS2,PS3,EPS,EPSF,EPSI,EPI,EPT,PDF,EPDF,XPS,PCL,AI}" />Use the full format list. A shorter list leaves some PostScript file types open.
cagefsctl --addrpm ImageMagick-libs
cagefsctl --force-update/scripts/restartsrv_apache
/scripts/restartsrv_apache_php_fpmPackage updates keep the edit, because both policy files are configuration files the packages don’t overwrite.
The trade-off: ImageMagick stops processing PDF, EPS, and PostScript files, so PDF thumbnails stop working, for example. The policy also doesn’t cover software that runs Ghostscript directly rather than through ImageMagick. Only the package update closes that.
On CageFS servers, another option is to remove Ghostscript from CageFS. Support tested it on CloudLinux 8 and 9. It blocks the route for users inside CageFS only, and they lose PDF, EPS, and PostScript processing:
cagefsctl --delrpm ghostscript
cagefsctl --force-update
The flaw is in .putgstringcopy, one of Ghostscript’s internal PostScript procedures. A crafted document can use it to reach operations that -dSAFER, Ghostscript’s sandbox for untrusted files, is meant to block. From there it can run code with the privileges of whatever process called Ghostscript. On a hosting server, that’s usually the web server or PHP process making thumbnails for a site, running as the site’s user.
Ghostscript sits underneath image conversion and document previews, so any feature that turns an uploaded file into an image can reach it. The pwn.ai write-up follows that path through WordPress. AlmaLinux also lists shared print queues and webmail thumbnails as routes.
CageFS doesn’t stop this attack. A user’s imagick inside CageFS still hands the disguised file to Ghostscript. The update closes it. The ImageMagick policy above blocks the upload-and-thumbnail route until then.
VulnCheck, which assigned the CVE, scores it 8.5 (High) on CVSS 4.0 and 7.8 (High) on CVSS 3.1. As of November 10, CISA’s assessment in the CVE record lists exploitation as none.
Nikolay Galov
Comments