font-loader `.forceput` recovery chain that escapes `-dSAFER` on every Ghostscript release
from 9.26 through 10.07.1 and executes a command as the renderer's account. Pass it a
Collaborator (or any OOB canary) domain and it emits ready-to-upload PostScript payloads
(HTTP+DNS callback, DNS-only exfiltration, and a signature-evasion variant) with
PDF/PNG/JPG-named copies. On patched Ghostscript (10.08.0+) the payloads detect the fix
and send nothing, so they double as a safe presence probe. Based on the research published
by Paulos Yibelo / pwn.ai ("How We Hacked the Pipes — Upload2Shell"); use only on systems
Payload generator for **CVE-2026-125396** ("Upload2Shell") — a Ghostscript font-loader
error-path `.forceput` recovery leading to a save/restore use-after-free, a `-dSAFER`
escape, and command execution. Fixed in Ghostscript **10.08.0**.
Original research (the vulnerability, the chain, and the disclosure):
**"How We Hacked the Pipes — Upload2Shell"**, Paulos Yibelo, pwn.ai —
- CVE record: (CVSS 4.0: 8.5)
- Artifex fixes: `1484854e0c8ddfda1baa4ad4cd965b8a9790aa81` (operand validation),
`e0421767e13627e75055bb44cb01486887c2f9e8` (helper moved to C)
`generate_upload2shell_payloads.py` takes a Collaborator (or any OOB canary) domain and
emits a self-contained PostScript payload per variant, with `.pdf`/`.png`/`.jpg`-named
| `upload2shell_collab.ps/.pdf/.png/.jpg` | HTTP `GET /UPLOAD2SHELL_CURL_OK` + DNS `upload2shell-probe.` |
| `upload2shell_dns.ps` | DNS only: `up2s--.` (no curl dependency) |
| `upload2shell_collab_obs.ps/.pdf` | same as collab, signature-evasion variant (no `%!` header, hex-encoded tokens) |
The chain defeats `-dSAFER` across the entire pre-fix family — machine-verified on
Ghostscript 9.26, 9.27, 9.50, 9.51, 9.55, 10.02.0, 10.05.1, 10.07.1, 10.07.0. On fixed
builds (>= 10.08.0) it prints `VERDICT=PATCHED` and sends **nothing** — usable as a safe
python3 generate_upload2shell_payloads.py [--out DIR] [--zip]
Upload through any endpoint that processes the file:
curl -F "f=@upload2shell_collab.pdf;filename=report.pdf" https://
The upload must be *processed* (preview / thumbnail / metadata / conversion) by a renderer
that reaches Ghostscript < 10.08.0: ImageMagick/Imagick, Pillow, libvips (magickload),
KImageFormats, or a direct `gs` call. A stored-but-never-rendered file does nothing.
Known boundary: a real `%PDF` file can never carry this chain — gs ignores embedded
PostScript (`/Subtype /PS` XObjects) on every version, so upload layers that magic-validate
content against the extension block the vector at the application layer. The
signature-evasion variant dodges WAF rules, not MIME magic checks.
Use only on systems you are authorized to test. The payloads execute a command as the
renderer process's account; on patched Ghostscript they are inert by design.
The vulnerability and its disclosure belong to pwn.ai / Paulos Yibelo. This repository is an
independent reconstruction and tooling for authorized testing, not affiliated with pwn.ai.
