Researchers at pwn.ai published Upload2Shell on November 21, 2026: CVE-2026-125396 is a high-severity bypass of Ghostscript's -dSAFER sandbox in Ghostscript before 10.08.0. A crafted PostScript or PDF can abuse the Type 1 font loader, recover the privileged internal .forceput operator, corrupt interpreter memory, and turn off native path controls so the renderer runs attacker-chosen commands—as the CUPS, Roundcube, or WordPress user in pwn.ai's demos, not only as a local attacker.
If you run coding agents on a laptop or homelab that also hosts ComfyUI, AUTOMATIC1111, Gradio, or InvokeAI, the practical risk is indirect: those stacks often call Pillow or ImageMagick, which start Ghostscript when they decode EPS or mislabeled PostScript during preview, thumbnail, or img2img steps. The agent does not need to shell out to gs; it only needs to pass a file into an image pipeline that does.
The Beam CVE page for this flaw is . Artifex fixed the root bug in Ghostscript 10.08.0 (8 September 2026); details and coordinated disclosure notes are in Ghostscript bug 709684.
TL;DR
| Question | Answer (as of November 22, 2026) |
|---|---|
| Am I affected? | Yes if any upload, email thumbnail, or print path on your stack runs Ghostscript < 10.08.0 under -dSAFER |
| Is there a fix? | Upgrade to Ghostscript 10.08.0+ (or your distro's backported package). vLLM 0.32.0+ and Rails activestorage 8.0.5.2 / 8.1.4.1 address adjacent chains but do not replace a patched gs |
| Is it exploited in the wild? | No public reports cited in pwn.ai's November 21 write-up |
| Does data leave my machine? | This is server-side RCE on the host that renders the file—not an exfiltration bug by itself |
| Coding-agent takeaway? | gs --version inside the container your agent uses, not only on the host OS |
How an ordinary upload reaches Ghostscript
pwn.ai's research started from ImageMagick security policies and followed ordinary features—cropping, thumbnails, PDF previews—until a trusted-looking extension still handed bytes to Ghostscript.
Image: pwn.ai
A PHP app calling Imagick does not invoke gs in application code. ImageMagick picks a PostScript delegate, which runs Ghostscript with -dSAFER. Python's Pillow 13.0.0 in pwn.ai's matrix invoked Ghostscript when Image.open() was followed by load(), crop(), or thumbnail() on EPS content—even when the file was named .png but contained PostScript bytes.
That matters for AI agent application and supply-chain security: the vulnerable component often sits three libraries deep from the feature an agent adds ("accept user images", "generate preview", "import PDF attachment").
The mechanism in brief
Ghostscript loads fonts through PostScript helpers. The bug sits in .putgstringcopy in Resource/Init/gs_fonts.ps, which calls .forceput without validating operand types. pwn.ai's proof:
- Register a malicious Type 1 font whose loader replaces a string on the operand stack with an array so
copyraisestypecheck. - An error handler catches the failure and rearranges the stack so execution resumes at
.forceputwith attacker-chosen dictionary, key, and value. - A global dictionary keeps a reference to a local object across
save/restore, creating a use-after-free when the local allocation is reused. - With a write-what-where primitive, the proof walks Ghostscript's own pointers to flip
path_control_activeand PostScript-sidePermitFileWriting, so-dSAFERon the command line no longer blocks%pipe%command execution.
CVSS 4.0 for the interpreter flaw is 8.5 per VulnCheck's advisory summary and the NVD entry. pwn.ai notes the CVE uses a local attack vector even though their demos reached the interpreter over the network through CUPS, email thumbnails, and public upload widgets.
Artifex's fix validates operands before copy can fail and later moves the helper into C to drop dependence on .forceput, per the maintainer thread in bug 709684.
From memory corruption to %pipe% execution
After the use-after-free gives the document a stale pointer into live interpreter data, pwn.ai's proof walks Ghostscript's own structures—currentdevice, gx_device, gs_memory_t, and finally path_control_active on gs_lib_ctx_core_t—without guessing fixed addresses. Disabling path_control_active turns off the native path check that -dSAFER relies on, even while the flag remains on the command line.
The Debian CUPS demo then used %pipe% to run printf into /var/tmp, recorded as successful command execution as uid=7(lp). That is a bounded proof, but it shows the gap between "we run gs with -dSAFER" in documentation and "the sandbox bit in memory still blocks pipes" at runtime. Application mitigations—WordPress 7.0.4, queue authentication, stripping Ghostscript delegates—sit at different layers; none replaces a patched interpreter when the font-loader bug is reachable.
Where pwn.ai demonstrated remote impact
The November 21 article lists repeatable chains (not all public PoCs yet). Highlights for teams who run mixed web and agent infrastructure:
| Path | Trigger (summarized from pwn.ai) | Process context |
|---|---|---|
| Debian 13 CUPS | Anonymous IPP Print-Job to an open queue | uid=7(lp) |
| Roundcube | View email with disguised PostScript as JPEG thumbnail | www-data |
| WordPress + plugins | Public PDF upload or Imagick preview | www-data |
| MediaWiki / DokuWiki | Anonymous upload + thumbnail when configured | www-data |
pwn.ai separately names Gradio, InvokeAI, ComfyUI, and AUTOMATIC1111 as code paths where Pillow pixel loads reached Ghostscript on Ubuntu 24.04 when Ghostscript was installed—typical layouts on local GPU workstations agents SSH into or script against.
For Rails shops, this stacks with CVE-2026-122006 Active Storage ImageMagick (critical file read/write via unconstrained coders). Even with Rails patched, a vulnerable system Ghostscript behind ImageMagick can still execute commands if policy allows the delegate.
For vLLM operators, recall the EPS → Ghostscript chain patched in vLLM 0.32.0—that advisory explicitly tied multimodal EPS handling to Ghostscript builds vulnerable to older flaws. CVE-2026-125396 is a distinct -dSAFER bypass; pinning vLLM does not absolve a stale gs package inside the inference image.
What this means if you run AI coding agents
Coding agents rarely embed Ghostscript, but they accelerate projects that do:
- Scaffolding image upload APIs (Gradio, FastAPI + Pillow, Rails Active Storage) without asking which decoder runs on pixel load.
- Driving ComfyUI or InvokeAI from the CLI to batch-ingest "reference images" an agent fetched from the web.
- Debugging print or preview features on a shared dev server that still runs CUPS with network-visible queues.
Concrete checks from primary sources:
gs --version
which gs
docker exec <comfyui-container> gs --version 2>/dev/null || true
dpkg -l ghostscript 2>/dev/null || rpm -q ghostscript 2>/dev/null
Upgrade target: Ghostscript 10.08.0 or newer, or the fixed package named in your vendor advisory (for example Ubuntu USN-8949-1 builds listed in pwn.ai's tables). Rebuild container images after the host package updates—a document worker may still ship an old gs copy.
Policy and exposure reduction (application-layer, from pwn.ai and Rails guidance):
- Disable anonymous network print queues; require auth on IPP submission.
- For Roundcube-style flows, identify file types before thumbnail generation when your stack allows that ordering change.
- On ImageMagick deployments, restrict PostScript and PDF delegates in
policy.xmlwhen previews are not required—Rails' fixedpolicy.xmlpattern in the Active Storage advisory is a useful template even outside Rails.
Secret rotation: If untrusted uploads could have reached Imagick + Ghostscript on versions before 10.08.0, treat app secrets readable by that UNIX user as potentially exposed, the same way you would after ImageMagick arbitrary read advisories.
What Beam can and cannot do here
Beam runs on your workstation and watches Claude Code, Codex, and similar harnesses: PreToolUse denies, skill and MCP config scans, and local audit storage with redaction. It does not patch Ghostscript, inspect Pillow pixel paths, or sandbox ComfyUI containers.
Where Beam still helps: if an agent tries to curl a proof-of-concept PostScript into your project, pipe remote scripts into shell, or open dangerous MCP tools while debugging an image pipeline, hook-based denies and scans can surface that before the file ever hits a renderer. That is heuristic, harness-specific coverage—not a substitute for gs --version on the machine that actually decodes uploads.
See how Beam watches agent actions and local-first storage if you are wiring policy on dev laptops that also host local inference UIs.
Patch status and verification
Artifex released 10.08.0 on 8 September 2026 with "potential security issues" called out in the release notes. pwn.ai's vendor tables (current through 12 November 2026 in the article) warn that Debian 12 Bookworm, some Amazon Linux branches, and selected SUSE lines were still vulnerable or pending—so a green CI image from October does not prove your runtime gs picked up the backport.
To confirm the fix class without guessing commit hashes:
- Debian/Ubuntu: compare installed package version to your security tracker (USN, DSA).
- Containers: inspect the layer that installs
ghostscript, not only the base OS label. - macOS/Homebrew or MacPorts:
brew list --versions ghostscriptorport installed ghostscriptafter upgrade.
pwn.ai's self-contained PostScript proof for native operator overwrite is published at the bottom of the research page; on 10.08.0, their article states the dangling-reference step fails before the pointer write—useful if you must validate a contested build in a isolated VM.
How to tell if uploads already reached a vulnerable renderer
Ghostscript execution is easy to miss in logs because it often appears as a child process of ImageMagick or gstopdf, not your application binary. Useful signals if you already collect host telemetry:
- Sudden
gsorgstopdfprocesses owned bywww-data,lp, or your document worker user immediately after image uploads or print jobs. - New files under
/var/tmpor web-writable directories with names matching pwn.ai's proof markers (GS_CUPS_PIPE_RCE,POST_SAFER_UAF_PIPE_RCEin their bounded CUPS demo—treat any unexpected marker file as worth investigating). - Thumbnail or preview workers exiting with segfaults or typecheck errors in Ghostscript stderr while
-dSAFERis set (their font-loader path deliberately triggerstypecheckbefore recovery).
None of those signals are definitive without filesystem and process captures. If you lack them, assume any internet-exposed upload or print feature before September 2026 patches on an unpatched gs warrants credential rotation for secrets that user could read.
Related reading
- CVE-2026-122006: Rails Active Storage + ImageMagick
- vLLM 0.32.0: EPS Ghostscript chain among eight advisories
- AI agent application and supply-chain security
- MCP security practical guide
- November 2026 attacks timeline
Frequently asked questions
What is CVE-2026-125396?
It is pwn.ai's Upload2Shell chain: a Type 1 font-loader bug in Ghostscript before 10.08.0 that recovers .forceput, corrupts interpreter memory, and disables -dSAFER file and pipe restrictions so crafted documents execute commands as the rendering user.
Which Ghostscript versions are fixed?
Ghostscript 10.08.0 (released 8 September 2026) is the first upstream release with Artifex's fix. Linux vendors may ship older version numbers with backports—verify the installed package, not only the marketing version on the download page.
How do coding agents trigger Ghostscript?
Agents usually call higher-level APIs—Image.load(), Gradio preprocessing, ComfyUI preview routes—that invoke Pillow or ImageMagick. Those libraries start gs -dSAFER when decoding EPS-like content. An agent that automates img2img or attachment import can feed malicious bytes without ever mentioning Ghostscript in generated code.
Does Beam block Upload2Shell?
No. Beam does not sit in the image decode path. Use gs --version and container image rebuilds for mitigation; use Beam to catch risky agent commands that fetch or install untrusted render pipelines on the same laptop.
Ghostscript versions, distribution packages, and pwn.ai demonstration tables are accurate as of November 22, 2026 UTC. Re-check gs --version on every host and container that renders untrusted images or documents before treating this as resolved.

