AlmaLinux OS 10.3 y 9.9 ¡ya disponible!  |  Encuéntrenos en SC26 Del 16 al 19 de noviembre, puesto n.º 1704  |  Díganos qué debería hacer AlmaLinux a continuación
Todas las entradas del blog

Upload2Shell (CVE-2026-125396): Patched Ghostscript available in testing

profile
Andrew Lukoshko

AlmaLinux Lead Architect

Upload2Shell (CVE-2026-125396): Patched. Call for testing

A Ghostscript vulnerability named Upload2Shell, tracked as CVE-2026-125396, lets a crafted PostScript document escape Ghostscript’s -dSAFER sandbox and run commands as the user that renders the document. Ghostscript is rarely called directly; it sits underneath print queues, image conversion, thumbnailing, and document previews, so a file upload or a print job can be enough to reach it. AlmaLinux 8, 9, and 10 are affected. Patched packages are available in the testing repository today, and we would like your help verifying them before we release them to production.

More information about the vulnerability:

Summary

PostScript is a programming language, so rendering a PostScript file means running a program. Ghostscript’s -dSAFER mode is what keeps that program from reading and writing arbitrary files or starting other commands. Almost everything that hands untrusted documents to Ghostscript relies on it.

Parts of Ghostscript’s font loading are themselves written in PostScript. One internal helper, .putgstringcopy, needs to write into protected font dictionaries and uses a privileged internal operator to do so. The helper did not check the types of its operands. A crafted Type 1 font could make an earlier step in the helper fail, and the document’s own error handler could then continue into the privileged write with values of its choosing.

The researchers used that write to keep a reference to memory that Ghostscript later frees, a use-after-free. From there they could read and write the interpreter’s native memory, switch off the path checks that -dSAFER enforces, and run a command.

The fix makes the helper verify its operand types before doing anything, so the error path that exposed the privileged write can no longer be reached.

Impact

A document that reaches a vulnerable Ghostscript can run commands with the privileges of the process that rendered it. That is typically a service account: lp for a print queue, or the web server user for an upload handler.

The CVE is scored 8.5 under CVSS 4.0 with a local attack vector, because the flaw is in the interpreter rather than in a network service. In practice, whether it is remotely reachable depends on what feeds documents to Ghostscript. The researchers demonstrated remote command execution through several common routes, including:

  • A print job sent to a shared CUPS queue that accepts jobs without authentication
  • An email attachment thumbnailed by a webmail application
  • File uploads in web applications that generate previews or resize images through ImageMagick

The file does not need a PostScript extension. Image libraries that inspect file contents can pass a file named .jpg, .png, or .pdf to Ghostscript if its bytes are PostScript.

On AlmaLinux, the ghostscript and libgs packages are used by the printing stack (cups-filters) and by other software that renders or converts PostScript, EPS, and PDF, such as ImageMagick from EPEL. If your systems print, or process documents and images that someone else supplies, treat this as a priority.

Patching ahead of our upstream

Security is a top priority at AlmaLinux. At the time of writing, we are not aware of fixed Ghostscript packages for RHEL 8, 9, or 10, and the researchers note that they did not establish whether current RHEL-family packages contain the fix. Our core team has backported the upstream fix to every supported AlmaLinux release.

The vulnerable helper is the same in the Ghostscript versions shipped in AlmaLinux 8 (9.27), 9 (9.54.0), and 10 (10.02.1), and the upstream change applies to all three with only minor context adjustments. Debian and Ubuntu have shipped the same backport in their security updates.

Patched package versions

  • AlmaLinux 8: ghostscript-9.27-20.el8_10.alma.1
  • AlmaLinux 9: ghostscript-9.54.0-19.el9_8.3.alma.1
  • AlmaLinux 10: ghostscript-10.02.1-16.el10_2.3.alma.1

The same versions apply to the libgs subpackage, which holds the interpreter library and is what most applications actually use.

Installing from the testing repository

sudo dnf install -y almalinux-release-testing
sudo dnf update 'ghostscript*' libgs --enablerepo=almalinux-testing

Confirm with rpm -q ghostscript libgs against the versions above.

No reboot is needed. Commands that start gs pick up the fix on their next run. Long-running services that have the Ghostscript library loaded keep using the old copy until they are restarted; sudo dnf needs-restarting lists them.

If you do not want the testing repo enabled afterwards (and on a production box you almost certainly do not), disable it once you have updated:

sudo dnf config-manager --disable almalinux-testing

Remember that containers and application bundles carry their own copy of Ghostscript. Updating the host does not update a copy inside a container image.

If you run into anything, please let us know in AlmaLinux chat or on bugs.almalinux.org.

Is there a workaround?

There is no setting in Ghostscript that removes the bug, and -dSAFER is the protection being bypassed. What you can do until you update is reduce the ways an untrusted document can reach Ghostscript:

  • Print servers: do not share CUPS queues with networks you do not trust, and require authentication for print jobs on shared queues.
  • ImageMagick: if you do not need PostScript, EPS, or PDF conversion, disable those coders in ImageMagick’s policy.xml so that it does not hand such files to Ghostscript.
  • Web applications: check a file’s real type before it is thumbnailed or converted, not after, and turn off preview generation for document types you do not need.

These narrow the exposure but are easy to get wrong, because the route to Ghostscript is often several dependencies below the application. Installing the patched packages is the reliable fix.

Thanks

Thanks to Paulos Yibelo and pwn.ai for finding and reporting this vulnerability, and to Ken Sharp and the Artifex team for the upstream fix. Thanks also to the Debian and Ubuntu security teams, whose backports to older Ghostscript releases we consulted.

Thanks to the AlmaLinux core team for turning around patched builds for every supported release.

Stay informed

Remaining aware of these vulnerabilities and acting quickly can keep your systems and data safe. Follow the AlmaLinux Blog, join the Mattermost Community Chat, and subscribe to the Announce and Security mailing lists to stay informed.

Changelog

  • 2026-11-22: Initial post published. Patched Ghostscript packages available in almalinux-testing for AlmaLinux 8, 9, and 10.

¡Manténgase al día!