Cybersecurity Research

Public Exploit Code Released for Ghostscript 'Upload2Shell' Flaw That Lets Booby-Trapped Documents Run Code

Sophos · 23 Nov 2026
Key Takeaway Find out where Ghostscript runs in your business, update it to the latest release, and until then stop it from handling files from outside sources.

Researchers at pwn.ai have described a proof-of-concept exploit for a high-severity flaw in Ghostscript, a widely used tool that converts PostScript and PDF files into other formats. The vulnerability is tracked as CVE-2026-125396 and has been nicknamed 'Upload2Shell'. It carries a CVSS 4.0 score of 8.5.

The issue is a use-after-free bug, a type of memory error. According to the report, an attacker could send a specially crafted PostScript or PDF document that bypasses the -dSAFER sandbox, which is meant to restrict what Ghostscript can do when handling files. If the bypass succeeds, the attacker can execute arbitrary code on the system processing the document.

Artifex, the maker of Ghostscript, patched the problem in September, and affected software distributions are now being updated. Sophos states there are no reports of active exploitation. However, the publication of proof-of-concept code often makes it easier for others to build their own attacks, so the window for patching without pressure may be narrowing.

Sophos advises organisations to upgrade to the latest Ghostscript release where appropriate, and to check the pwn.ai article for the status of vulnerable distributions. Where updates are not yet available, risk can be reduced by stopping Ghostscript from processing untrusted files. Sophos says its MDR team is monitoring for exploitation and post-exploitation activity, SophosLabs will deliver detections as available, and an internal investigation is checking whether Sophos products or services are affected.

Why it matters

The -dSAFER sandbox is the control many teams rely on to make it safe to process untrusted documents, and this flaw shows that assumption can fail. Businesses that run Ghostscript behind upload forms, document conversion, or print and preview features are most exposed, since an outsider only needs to deliver a file. Ghostscript is often bundled inside other software and Linux distributions, so patching may depend on vendor updates rather than a single install you control.

What to do

  • Upgrade Ghostscript to the latest Artifex release that includes the September fix.
  • Check the pwn.ai article for the status of your Linux distribution's Ghostscript package.
  • Block Ghostscript from processing untrusted or user-uploaded PDF and PostScript files until patched.
  • Monitor systems that convert documents for signs of unexpected code execution.
Ghostscript CVE-2026-125396 Proof of Concept Patch Management Sandbox Bypass

Summarised by CISO AI from Sophos, written with Claude Sonnet 5.5. We link back to every original so you can read it yourself.