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.
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | ghostscript | 9.25~dfsg-1 | — |
| Debian 13 | ghostscript | 9.25~dfsg-1 | — |
| Debian 12 | ghostscript | 9.25~dfsg-1 | — |
| Debian 9 | ghostscript | 9.20~dfsg-3.2+deb9u5 | DSA-4294-1 |
| Debian 8 | ghostscript | 9.06~dfsg-2+deb8u8 | DLA-1504-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 18.04 LTS | ghostscript | 9.22~dfsg+1-0ubuntu1.2 | USN-3768-1 |
| Ubuntu 16.04 LTS | ghostscript | 9.18~dfsg~0-0ubuntu2.9 | USN-3768-1 |
| Ubuntu 14.04 LTS | ghostscript | 9.10~dfsg-0ubuntu10.13 | USN-3768-1 |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| RHEL 7 | ghostscript +4 | 9.07-29.el7_5.2 | RHSA-2018:2918 |
| RHEL 6 | ghostscript +3 | 8.70-24.el6_10.2 | RHSA-2018:3760 |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 15 | ghostscript | 9.25-3.6.1 | SUSE-SU-2018:2976-1 |
| SLES 15 | libspectre | 0.2.8-3.2.1 | SUSE-SU-2018:2976-1 |
| SLES 12 SP3 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-1 |
| SLES 12 SP2 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-2, SUSE-SU-2018:2975-1 |
| SLES 12 SP1 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-1 |
| SLES 12 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-1 |
Show 9 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 11 SP4 | ghostscript-library | 8.62-32.47.13.1 | SUSE-SU-2018:3330-1 |
| SLES 11 SP3 | ghostscript-library | 8.62-32.47.13.1 | SUSE-SU-2018:3330-1 |
| SLES for SAP 12 SP3 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-1 |
| SLES for SAP 12 SP2 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-1 |
| SLES for SAP 12 SP1 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-3 |
| SLES for SAP 11 SP4 | ghostscript-library | 8.62-32.47.13.1 | SUSE-SU-2018:3330-1 |
| SUSE OpenStack Cloud 7 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-1 |
| SUSE Linux Enterprise Point of Sale 11 SP3 | ghostscript-library | 8.62-32.47.13.1 | SUSE-SU-2018:3330-1 |
| SUSE Enterprise Storage 4 | ghostscript | 9.25-23.13.1 | SUSE-SU-2018:2975-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | ghostscript | 9.54.0-2.2 | openSUSE-SU-2024:10783-1 |
Amazon Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Amazon Linux 2 | ghostscript +4 | 9.06-8.amzn2.0.5 | ALAS2-2018-1088 |
Oracle Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Oracle Linux 7 | ghostscript +4 | 9.07-29.el7_5.2 | ELSA-2018-2918 |
Public exploits
Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.
Metasploit 1 module
-
Ghostscript Failed Restore Command Execution
exploit/multi/fileformat/ghostscript_failed_restore
Exploit-DB 1
- Ghostscript - Failed Restore Command Execution (Metasploit) EDB-45369 · local · Sep 10, 2018 · verified
GitHub 5 repositories
-
farisv/PIL-RCE-Ghostscript-CVE-2018-16509 ★ 62 · Oct 15, 2018
PoC + Docker Environment for Python PIL/Pillow Remote Shell Command Execution via Ghostscript CVE-2018-16509
-
knqyf263/CVE-2018-16509 ★ 3 · Nov 17, 2018
CVE-2018-16509 (Ghostscript contains multiple -dSAFER sandbox bypass vulnerabilities)
-
rhpco/CVE-2018-16509 ★ 1 · Aug 4, 2019
CVE-2018-16509 Docker Playground - Ghostscript command execution
-
CyberCTF/vulhub-ghostscript-cve-2018-16509 ★ 0 · Oct 8, 2026
Vulhub ghostscript/CVE-2018-16509: Ghostscript -dSAFER Sandbox Bypass (CVE-2018-16509), run with Isoloom
-
cved-sources/cve-2018-16509 ★ 0 · Jan 11, 2019
cve-2018-16509
Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.
Advisories 13
- RHSA-2018:3760 Red Hat Security Advisory: ghostscript security update Red Hat Security Advisories (RHSA) · Jun 26, 2026
- RHSA-2018:2918 Red Hat Security Advisory: ghostscript security update Red Hat Security Advisories (RHSA) · Jun 26, 2026
- USN-3768-1 ghostscript vulnerabilities Ubuntu Security Notices (USN) · Apr 22, 2026
- DSA-4294-1 ghostscript - security update Debian Security (DSA / DLA) · Mar 9, 2026
- DLA-1504-1 ghostscript - security update Debian Security (DSA / DLA) · Mar 9, 2026
- openSUSE-SU-2024:10783-1 ghostscript-9.54.0-2.2 on GA media SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2018:2976-1 Security update for ghostscript SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2018:2975-3 Security update for ghostscript SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2018:3330-1 Security update for ghostscript-library SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2018:2975-2 Security update for ghostscript SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2018:2975-1 Security update for ghostscript SUSE / openSUSE Security Updates · May 2, 2025
- ELSA-2018-2918 Important: ghostscript security update (Oracle Linux 7) Oracle Linux Security Advisories (ELSA) · Oct 15, 2018
- ALAS2-2018-1088 Important: ghostscript security update (Amazon Linux 2) Amazon Linux Security Center (ALAS) · Oct 10, 2018
References
- http://git.ghostscript.com/?p=ghostpdl.git%3Ba=commit%3Bh=5516c614dc33662a2afdc377159f70218e67bde5
- 45369 exploit
- https://bugs.ghostscript.com/show_bug.cgi?id=699654
- RHSA-2018:2918 vendor-advisory
- http://git.ghostscript.com/?p=ghostpdl.git%3Ba=commit%3Bh=79cccf641486a6595c43f1de1cd7ade696020a31
- GLSA-201811-12 vendor-advisory
- USN-3768-1 vendor-advisory
- https://www.artifex.com/news/ghostscript-security-resolved/
- RHSA-2018:3760 vendor-advisory
- http://seclists.org/oss-sec/2018/q3/142
- DSA-4294 vendor-advisory
- [debian-lts-announce] 20180913 [SECURITY] [DLA 1504-1] ghostscript security update mailing-list
- 105122 vdb-entry
- http://git.ghostscript.com/?p=ghostpdl.git%3Ba=commit%3Bh=78911a01b67d590b4a91afac2e8417360b934156
- http://git.ghostscript.com/?p=ghostpdl.git%3Ba=commitdiff%3Bh=520bb0ea7519aa3e79db78aaf0589dae02103764