CVE-2018-16509

HIGH EXPLOITED IN THE WILD LAB

Artifex Ghostscript <9.24 - Privilege Escalation

Title source: llm
STIX 2.1

Exploitation Summary

CVE-2018-16509 has been observed exploited in the wild (reported by VulnCheck KEV, InTheWild.io). EIP tracks 6 public exploits from researchers including Metasploit, farisv, knqyf263, including a Metasploit module exploits/multi/fileformat/ghostscript_failed_restore.

AI-analyzed exploit summary This Metasploit module exploits a -dSAFER bypass in Ghostscript (CVE-2018-16509) by manipulating PostScript commands to execute arbitrary commands. It supports multiple targets including Unix, PowerShell, and Linux droppers.

Description

An issue was discovered in Artifex Ghostscript before 9.24. Incorrect "restoration of privilege" checking during handling of /invalidaccess exceptions could be used by attackers able to supply crafted PostScript to execute code using the "pipe" instruction.

Exploits (6)

exploitdb WORKING POC VERIFIED
by Metasploit · rubylocallinux
https://www.exploit-db.com/exploits/45369

This Metasploit module exploits a -dSAFER bypass in Ghostscript (CVE-2018-16509) by manipulating PostScript commands to execute arbitrary commands. It supports multiple targets including Unix, PowerShell, and Linux droppers.

Classification
Working Poc 100%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: Ghostscript (versions affected by CVE-2018-16509)
No auth needed
Prerequisites: Victim must process a malicious PostScript file · Ghostscript with vulnerable version
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec WORKING POC 58 stars
by farisv · remote-auth
https://github.com/farisv/PIL-RCE-Ghostscript-CVE-2018-16509

This repository provides a working proof-of-concept for CVE-2018-16509, exploiting a Ghostscript vulnerability via PIL/Pillow to achieve remote command execution. The exploit leverages a crafted EPS file to bypass -dSAFER restrictions in Ghostscript versions before 9.24.

Classification
Working Poc 100%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: Ghostscript < 9.24 (via PIL/Pillow)
No auth needed
Prerequisites: Ghostscript < 9.24 installed on the target system · PIL/Pillow library used to process uploaded images · Ability to upload a crafted EPS file to the target application
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec WORKING POC 3 stars
by knqyf263 · poc
https://github.com/knqyf263/CVE-2018-16509

This repository demonstrates a Ghostscript -dSAFER sandbox bypass vulnerability (CVE-2018-16509) via a PHP script that processes image uploads using Imagick, which relies on Ghostscript. The exploit leverages improper handling of PostScript files to bypass security restrictions.

Classification
Working Poc 90%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: Ghostscript (versions prior to 9.24)
No auth needed
Prerequisites: A vulnerable version of Ghostscript · Ability to upload a malicious PostScript file
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec WORKING POC 1 stars
by rhpco · poc
https://github.com/rhpco/CVE-2018-16509

This repository contains a working exploit for CVE-2018-16509, a privilege escalation vulnerability in Ghostscript. The exploit leverages incorrect restoration of privilege checks during handling of /invalidaccess exceptions to execute arbitrary code via the 'pipe' instruction.

Classification
Working Poc 95%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: Artifex Ghostscript before 9.24
No auth needed
Prerequisites: Ability to supply crafted PostScript to the target system
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec STUB
by cved-sources · poc
https://github.com/cved-sources/cve-2018-16509

The repository contains a minimal PHP script demonstrating image resizing via Imagick, but lacks exploit-specific code for CVE-2018-16509. The README references a Docker container management tool without providing exploit details.

Classification
Stub 80%
Attack Type
Other
Complexity
Trivial
Reliability
Theoretical
Target: ImageMagick (Imagick PHP extension)
No auth needed
Prerequisites: PHP with Imagick extension enabled
devstral-2 · analyzed Feb 16, 2026 Full analysis →
metasploit WORKING POC EXCELLENT
by Tavis Ormandy, wvu · rubypocunix
https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/fileformat/ghostscript_failed_restore.rb

This Metasploit module exploits a -dSAFER bypass in Ghostscript (CVE-2018-16509) by manipulating a failed restore in PostScript to disable LockSafetyParams and execute arbitrary commands. It supports multiple targets including Unix, PowerShell, and Linux dropper payloads.

Classification
Working Poc 100%
Attack Type
Rce
Complexity
Moderate
Reliability
Reliable
Target: Ghostscript (versions affected by CVE-2018-16509)
No auth needed
Prerequisites: Access to a system with vulnerable Ghostscript · Ability to deliver a malicious PostScript file
devstral-2 · analyzed Feb 16, 2026 Full analysis →

References (15)

Core 15
Core References
Exploit, Third Party Advisory, VDB Entry exploit x_refsource_exploit-db
https://www.exploit-db.com/exploits/45369/
Issue Tracking, Permissions Required, Third Party Advisory x_refsource_misc
https://bugs.ghostscript.com/show_bug.cgi?id=699654
Third Party Advisory vendor-advisory x_refsource_redhat
https://access.redhat.com/errata/RHSA-2018:2918
Third Party Advisory vendor-advisory x_refsource_gentoo
https://security.gentoo.org/glsa/201811-12
Third Party Advisory vendor-advisory x_refsource_ubuntu
https://usn.ubuntu.com/3768-1/
Third Party Advisory vendor-advisory x_refsource_redhat
https://access.redhat.com/errata/RHSA-2018:3760
Exploit, Mailing List, Third Party Advisory x_refsource_misc
http://seclists.org/oss-sec/2018/q3/142
Third Party Advisory vendor-advisory x_refsource_debian
https://www.debian.org/security/2018/dsa-4294
Mailing List, Third Party Advisory mailing-list x_refsource_mlist
https://lists.debian.org/debian-lts-announce/2018/09/msg00015.html
Third Party Advisory, VDB Entry vdb-entry x_refsource_bid
http://www.securityfocus.com/bid/105122

Scores

CVSS v3 7.8
EPSS 0.9176
EPSS Percentile 99.7%
Attack Vector LOCAL
CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Details

VulnCheck KEV 2024-05-10
InTheWild.io 2024-05-17
Status published
Products (14)
artifex/ghostscript < 9.24
artifex/gpl_ghostscript < 9.26
canonical/ubuntu_linux 14.04
canonical/ubuntu_linux 16.04
canonical/ubuntu_linux 18.04
debian/debian_linux 8.0
debian/debian_linux 9.0
redhat/enterprise_linux_desktop 6.0
redhat/enterprise_linux_desktop 7.0
redhat/enterprise_linux_server 6.0
... and 4 more
Published Sep 05, 2018
Tracked Since Feb 18, 2026