Upload2Shell (CVE-2026-125396): Patched Ghostscript released
Key points
AlmaLinux has released patched Ghostscript packages for Upload2Shell (CVE-2026-125396) to the production repositories of AlmaLinux 8, 9 and 10. The flaw lets a crafted PostScript document break out of the -dSAFER sandbox and run commands as the user rendering it. The builds first went to the testing repository on 2026-11-22 for community verification and moved to production on 2026-11-23, so a regular update is now enough.
The vulnerability
- An internal font-loading helper,
.putgstringcopy, uses a privileged operator to write into protected font dictionaries but did not validate its operand types. - A malicious Type 1 font can make an early step of the helper fail. The document's own error handler can then reach the privileged write with values it controls.
- The researchers turned this into a use-after-free, gained read/write access to the interpreter's native memory, disabled
-dSAFERpath checks and executed a command. - The upstream fix is commit 1484854e0c8d ("PS interpreter - validate operands to .putgstringcopy"), shipped in Ghostscript 10.08.0 and tracked as Artifex Bug 709684. It adds a type check before the helper does any work.
- The issue was found by Paulos Yibelo and pwn.ai. The upstream fix is by Ken Sharp and Artifex.
Impact
- Commands run with the privileges of whatever process renders the file, typically a service account such as
lpfor print queues or the web server user for upload handlers. - The CVSS 4.0 score is 8.5 with a local attack vector. Whether it is remotely reachable depends on what feeds documents to Ghostscript.
- Remote execution was demonstrated through:
- a shared CUPS queue that accepts unauthenticated jobs
- webmail thumbnailing of attachments
- web uploads previewed or resized via ImageMagick
- The file extension does not matter. Content-sniffing image libraries may pass a
.jpg,.pngor.pdffile to Ghostscript if its contents are PostScript. - On AlmaLinux,
ghostscriptandlibgsare used bycups-filtersand by tools such as ImageMagick from EPEL. Systems that print or process third-party documents and images should treat the update as a priority.
Versions
- AlmaLinux 8 ships Ghostscript 9.27 and is fixed in
ghostscript-9.27-20.el8_10.alma.1. - AlmaLinux 9 ships Ghostscript 9.54.0 and is fixed in
ghostscript-9.54.0-19.el9_8.3.alma.1. - AlmaLinux 10 ships Ghostscript 10.02.1 and is fixed in
ghostscript-10.02.1-16.el10_2.3.alma.1. - The
libgssubpackage, which most applications load, carries the same version numbers. Install the listed version or higher. - The core team backported the upstream fix itself. The project says it knows of no fixed RHEL 8, 9 or 10 packages yet.
- Debian and Ubuntu have already shipped the same backport, and their work was consulted.
How to update
- Refresh the metadata and upgrade Ghostscript, then confirm the installed versions against the list above. Most mirrors sync every few hours, so if the update is not visible yet, try again later:
sudo dnf clean metadata && sudo dnf upgrade 'ghostscript*' libgs
rpm -q ghostscript libgs
sudo dnf needs-restarting- No reboot is required, and new
gsinvocations use the fixed code immediately. - Long-running services that have the library loaded keep the old copy until restarted.
dnf needs-restartinglists them. - Anyone who enabled the testing repository to help test can disable it again with
sudo dnf config-manager --disable almalinux-testing. The testing-repo instructions stay in the post for reference only. - Containers and application bundles carry their own Ghostscript, so updating the host does not fix them.
- Report problems in the AlmaLinux chat or on bugs.almalinux.org.
Mitigations until patched
- Ghostscript has no option that disables the bug, since
-dSAFERis the very protection being bypassed. - On print servers, do not share CUPS queues with untrusted networks, and require authentication on shared queues.
- In ImageMagick, disable the PostScript, EPS and PDF coders in
policy.xmlif they are not needed. - In web applications, verify a file's real type before thumbnailing or converting it, and turn off previews for unneeded document types.
- The project warns these steps are easy to get wrong, because Ghostscript often sits several dependencies deep. Installing the packages is the dependable fix.
Summary by DistroNews, based on the original post.
The full text is on the original page.
Read the original at almalinux.org