Artifex's Ghostscript is one of the most quietly dangerous binaries on any Linux system. It sits underneath CUPS print queues, ImageMagick document conversion, mail gateway attachment rendering, preview generators, and OCR pipelines — and it parses attacker-controlled file formats by design. Debian's LTS advisory DLA-4914-1 patches CVE-2026-39919, a vulnerability that combines a buffer overflow in the Ghostscript interpreter with an escape from the -dSAFER sandbox, allowing a maliciously crafted document to execute arbitrary shell commands the moment it is rendered. If your organization runs Debian LTS (or any Debian derivative) with Ghostscript installed — and statistically, it does, because Ghostscript is pulled in as a dependency by printing and document-processing stacks — this requires immediate action.
Introduction: Why Ghostscript Is a Repeat Offender You Cannot Ignore
Ghostscript has a long, well-documented history of sandbox escape vulnerabilities, and for good reason: PostScript is a full programming language, not a passive document format. Features like file I/O operators and the %pipe% device exist in the language specification, and Ghostscript's security model depends almost entirely on the -dSAFER flag correctly restricting those operators. Every time that restriction fails, a document renderer becomes a remote code execution primitive.
CVE-2026-39919 is exactly that failure mode. An attacker supplies a document — a PDF invoice emailed to an AP clerk, a PostScript file sent to a print queue, an image passed through ImageMagick's convert, a report auto-generated by a web application — and when Ghostscript processes it, a buffer overflow corrupts interpreter state in a way that defeats the -dSAFER policy checks. The result is command execution under the privileges of whatever account invoked gs. On a print server that is often the lp user; in a web application's document pipeline it may be the application service account; in a misconfigured cron-driven workflow it can be worse.
The critical defensive insight: your users do not need to open anything. Any automated pipeline that renders untrusted documents with Ghostscript is a pre-authenticated remote execution surface. Mail filters, CUPS servers accepting jobs from the network, and web upload features that generate thumbnails or text extracts are all reachable without user interaction.
Technical Analysis
Affected Products and Platforms
- Product: Ghostscript (GPL Ghostscript / Artifex Ghostscript interpreter), the PostScript and PDF interpreter shipped across virtually all Linux distributions.
- Patched via: Debian LTS Advisory DLA-4914-1 for the Debian long-term support release (packages
ghostscript,ghostscript-x, and thelibgsshared library). - Exposure surface: Any Debian LTS host with Ghostscript installed — including hosts where it was installed transitively via CUPS (
cups-filters,foomatic), ImageMagick (libmagickcoredelegates PostScript/PDF/PDF-like formats togs),cups-filters,groff,evince/libspectre,djvulibre, LaTeX tooling, and numerous mail/DLP/document-processing stacks.
Debian's LTS tracker page for the package and the upstream Artifex advisory should be consulted for the exact fixed package version for your release; install updates via apt and verify the changelog references DLA-4914-1.
Vulnerability Mechanics (Defender's View)
The attack chain, from a detection standpoint, has three observable stages:
- Delivery: A crafted PostScript, PDF, or EPS file reaches the target — via email attachment processed by a gateway, a print job submitted to CUPS, an upload to a web application, or a file dropped into a watched folder.
- Trigger: A Ghostscript invocation (
gs, or a library call intolibgs.soby an embedding process such asconvert/magick,gswrapped bycups-filters, orps2pdf) parses the document. Malformed content overflows a buffer inside the interpreter. - Sandbox escape and execution: The corruption subverts the
-dSAFERfile-system and operator restrictions, after which the document's embedded PostScript uses a pipe device or file operator to execute a shell command. The observable artifact is a shell or command interpreter spawned as a child of the rendering process —sh,bash,dash,curl,wget,python, orbase64decode chains descending fromgsor from a process that embedslibgs.
Exploitation requires only that the attacker get the document rendered. No local access, no credentials, no user click is necessary in automated pipelines.
Exploitation Status
As of this writing, there is no confirmed public proof-of-concept exploit or CISA KEV listing for CVE-2026-39919. Treat that as a window, not a comfort. Ghostscript sandbox escapes historically attract rapid researcher attention and weaponization once patches land, because the patch diff effectively documents the flaw. Organizations should operate on the assumption that a working exploit is a matter of weeks, and patch on that timeline.
Detection & Response
The highest-fidelity detection for this class of vulnerability is behavioral: Ghostscript (or an embedding renderer) spawning a shell is almost never legitimate. gs has no business executing bash -c, downloading files, or writing executables to world-writable paths. The detections below target that invariant.
Sigma Rules
---
title: Ghostscript Process Spawning Shell or Command Interpreter
id: 3b8f2c61-7d4a-4e19-b5f2-9c1a6d8e3f07
status: experimental
description: Detects Ghostscript (gs/gsc/gswin) or libgs-embedding renderers spawning a shell or command interpreter, consistent with CVE-2026-39919 sandbox escape via malicious PostScript/PDF document rendering.
references:
- https://linuxsecurity.com/advisories/deblts/debian-lts-dla-4914-1-ghostscript
- https://attack.mitre.org/techniques/T1203/
author: Security Arsenal
date: 2026/04/06
tags:
- attack.execution
- attack.exploitation_for_client_execution
- attack.t1203
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|endswith:
- '/gs'
- '/gsx11'
- '/gsdjvu'
- '/convert'
- '/magick'
- '/ps2pdf'
- '/gsftopk'
selection_child:
Image|endswith:
- '/sh'
- '/bash'
- '/dash'
- '/zsh'
- '/curl'
- '/wget'
- '/python'
- '/python3'
- '/perl'
- '/base64'
- '/nc'
- '/ncat'
condition: selection_parent and selection_child
falsepositives:
- Rare legitimate print filter chains; validate against CUPS pipeline baselines
level: high
---
title: Suspicious Ghostscript Invocation With Network or Inline Execution Flags
id: 9e1c4a72-2f68-4b30-a7d1-5c8b3e6f94a2
status: experimental
description: Detects Ghostscript launched with PostScript code passed inline or piped from curl/wget, a pattern associated with exploit delivery and post-exploitation testing against CVE-2026-39919.
references:
- https://linuxsecurity.com/advisories/deblts/debian-lts-dla-4914-1-ghostscript
- https://attack.mitre.org/techniques/T1059/
author: Security Arsenal
date: 2026/04/06
tags:
- attack.execution
- attack.t1059
- attack.t1203
logsource:
category: process_creation
product: linux
detection:
selection_img:
Image|endswith: '/gs'
selection_cli:
CommandLine|contains:
- '%pipe%'
- '.forceput'
- '.setsafe'
- '-dNOSAFER'
- '--permit-file-read'
- '.locksafe'
condition: selection_img and selection_cli
falsepositives:
- Developer/test environments intentionally using PostScript internals
level: high
---
title: ImageMagick or CUPS Renderer Spawning Unexpected Downloader
id: 4d7a9e13-6c25-4f81-b8e3-2a9d5f1c7e60
status: experimental
description: Detects document rendering pipelines (ImageMagick convert/magick, CUPS filter processes) spawning network downloaders, indicating post-exploitation following Ghostscript sandbox escape.
references:
- https://linuxsecurity.com/advisories/deblts/debian-lts-dla-4914-1-ghostscript
- https://attack.mitre.org/techniques/T1105/
author: Security Arsenal
date: 2026/04/06
tags:
- attack.command_and_control
- attack.t1105
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|endswith:
- '/convert'
- '/magick'
- '/gs'
- '/foomatic-rip'
- '/gstoraster'
- '/imagetops'
selection_user:
User|contains:
- 'lp'
- 'www-data'
- 'apache'
- 'nginx'
selection_child:
Image|endswith:
- '/curl'
- '/wget'
- '/bash'
- '/sh'
condition: selection_parent and selection_user and selection_child
falsepositives:
- Legitimate document workflow scripts; baseline known-good pipelines
level: critical
KQL — Microsoft Sentinel / Defender
Even for Linux workloads, hunt in Sentinel via Syslog/CEF ingestion from your forwarders, or via Defender for Endpoint on Linux (DeviceProcessEvents).
// Hunt: Ghostscript or embedding renderers spawning shells/downloaders (CVE-2026-39919 behavior)
let renderers = dynamic(["gs", "gsx11", "convert", "magick", "ps2pdf", "foomatic-rip", "gstoraster", "imagetops"]);
let children = dynamic(["sh", "bash", "dash", "zsh", "curl", "wget", "python", "python3", "perl", "base64", "nc", "ncat"]);
DeviceProcessEvents
| where TimeGenerated > ago(14d)
| where InitiatingProcessFileName in~ (renderers)
| where FileName in~ (children)
| project TimeGenerated, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine,
FileName, ProcessCommandLine, AccountName, SHA256
| order by TimeGenerated desc;
// Hunt: Syslog-ingested Linux hosts — gs invocations referencing dangerous PostScript internals
Syslog
| where TimeGenerated > ago(14d)
| where ProcessName =~ "gs" or SyslogMessage has "gs"
| where SyslogMessage has_any ("%pipe%", "-dNOSAFER", ".forceput", ".setsafe", ".locksafe")
| project TimeGenerated, Computer, HostName, ProcessName, SyslogMessage
| order by TimeGenerated desc;
Velociraptor VQL
Use this artifact for live hunting across your Linux fleet to find rendering processes with suspicious lineage or inline-execution command lines.
-- Hunt: Ghostscript / renderer processes with suspicious children or command lines
-- Deploy as a fleet-wide hunt; snapshot pslist and flag high-risk lineage
SELECT Pid, Ppid, Name, CommandLine, Exe, Username, CreateTime
FROM pslist()
WHERE (
CommandLine =~ '%pipe%|NOSAFER|forceput|setsafe|locksafe'
OR (Name =~ '^(gs|convert|magick|ps2pdf|foomatic-rip|gstoraster)$'
AND CommandLine =~ 'curl|wget|base64|/tmp/')
)
OR (
Name =~ '^(sh|bash|dash|curl|wget|nc)$'
AND Ppid IN (
SELECT Pid FROM pslist()
WHERE Name =~ '^(gs|convert|magick|ps2pdf|foomatic-rip|gstoraster|imagetops)$'
)
)
Remediation
1. Patch Immediately
Apply DLA-4914-1 via the Debian package manager and confirm the update installed. The script below checks the installed version, applies available security updates for Ghostscript, and reports the package changelog entry confirming the fix.
#!/bin/bash
# CVE-2026-39919 — Ghostscript DLA-4914-1 patch verification and hardening (Debian LTS)
set -euo pipefail
echo "=== Current Ghostscript package status ==="
dpkg -l | grep -E 'ghostscript|libgs' || echo "Ghostscript packages not found"
gs --version || echo "gs binary not present"
echo "=== Applying security updates ==="
apt-get update
apt-get install --only-upgrade -y ghostscript ghostscript-x libgs10 libgs10-common 2>/dev/null \
|| apt-get install --only-upgrade -y ghostscript libgs9 libgs9-common
echo "=== Verifying fix is installed (look for DLA-4914-1 / CVE-2026-39919) ==="
zgrep -hE 'DLA-4914|CVE-2026-39919' /usr/share/doc/ghostscript/changelog.Debian.gz \
/usr/share/doc/libgs*/changelog.Debian.gz 2>/dev/null \
|| echo "WARNING: No changelog reference found — confirm DLA-4914-1 applied via debian-security-tracker"
echo "=== Audit: where does gs get invoked automatically? ==="
# ImageMagick delegation — confirm restrictive policy exists
POLICY=$(find /etc/ImageMagick* /usr/local/etc/ImageMagick* -name policy.xml 2>/dev/null | head -1)
if [ -n "$POLICY" ]; then
echo "ImageMagick policy found: $POLICY"
grep -E 'coder.*(PS|PDF|EPS|XPS)' "$POLICY" || echo "WARNING: PS/PDF/EPS coders not restricted in policy.xml"
else
echo "WARNING: No ImageMagick policy.xml found — create one restricting PS/PDF/EPS coders"
fi
echo "=== Confirm services embedding libgs are restarted post-patch ==="
for svc in cups cups-browsed; do
systemctl is-active --quiet "$svc" 2>/dev/null && systemctl restart "$svc" && echo "restarted: $svc"
done
echo "Done. Re-run Sigma/KQL hunts across the patch window for retroactive detection."
2. Reduce the Attack Surface While You Patch
- Block dangerous coders in ImageMagick. Ghostscript is only reachable through ImageMagick when the PS/PDF/EPS/XPS delegates are enabled. Add explicit deny policies to
/etc/ImageMagick-6/policy.xml(or/etc/ImageMagick-7/policy.xml):<policy domain="coder" rights="none" pattern="PS" />— and the same forPS2,PS3,EPS,PDF, andXPS, unless a documented business workflow requires them. - Enforce
-dSAFEReverywhere and never allow-dNOSAFER. Audit scripts, systemd units, cron jobs, and application code that invokegs. Any occurrence of-dNOSAFER,-dDELAYSAFERmisuse, or--permit-file-*flags on paths processing untrusted input must be removed. The whole premise of CVE-2026-39919 is the SAFER boundary — weakening it removes your last line of defense. - Isolate rendering. Run document-rendering pipelines in a sandboxed context: a dedicated container or VM with no sensitive mounts, no outbound network access (or egress filtered to an allowlist), a read-only root filesystem, and a non-root, unprivileged service account. A sandbox escape inside a locked-down renderer with no network is a far smaller incident.
- Restrict CUPS exposure. CUPS network listeners and IPP-Everywhere/AirPrint mDNS advertisements expand who can submit jobs to Ghostscript-backed filters. Bind CUPS to localhost where network printing is not required, and apply
LocationACLs where it is. - Filter at the gateway. Until patching is complete, treat inbound PostScript and EPS attachments as hostile: quarantine or strip them at the mail gateway, and apply extra scrutiny to PDFs entering automated processing paths.
3. Hunt Retroactively
A document-render exploit leaves a narrow forensic footprint, but the child-process artifact is durable. Run the Sigma and KQL hunts above across at least the last 14–30 days (whatever your log retention allows), focusing on print servers, mail gateways, and application hosts with document pipelines. Pay special attention to execution under lp, www-data, or application service accounts descending from renderer processes — that lineage is the signature of this vulnerability class.
4. Verify Dependencies
Inventory every host where ghostscript or libgs is installed, including container images — Ghostscript is a notorious stowaway dependency. dpkg -l | grep ghostscript across your fleet, plus image scanning in your registry, will find instances your CMDB forgot about. Unpatched containers rebuilding from stale base images are where this vulnerability will still be exploitable in six months.
Bottom Line
CVE-2026-39919 is a pre-authentication, document-driven code execution path in one of the most widely deployed parsers in the Linux ecosystem. There is no public exploit today; there will be. Patch DLA-4914-1 now, lock down ImageMagick delegates and CUPS exposure, enforce -dSAFER with no exceptions, and hunt for renderer-spawned shells retroactively. Ghostscript vulnerabilities are a solved problem only for teams that treat document rendering as the untrusted-input processing it actually is.
Related Resources
Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub
Is your security operations ready?
Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.