CVE-2018-16802
Description
Ghostscript before 9.25 incorrectly restores privileges when running out of stack during exception handling, allowing crafted PostScript to execute arbitrary code via the pipe instruction.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Ghostscript before 9.25 incorrectly restores privileges when running out of stack during exception handling, allowing crafted PostScript to execute arbitrary code via the pipe instruction.
Vulnerability
An issue was discovered in Artifex Ghostscript before version 9.25. The vulnerability involves incorrect "restoration of privilege" checking when running out of stack during exception handling [1][2]. This flaw is an incomplete fix for CVE-2018-16509, and it allows attackers who can supply crafted PostScript files to execute arbitrary code using the pipe instruction. The affected versions include Ghostscript prior to 9.25, and various distributions such as Red Hat Enterprise Linux 7 (ghostscript-9.07) and Ubuntu 18.04 LTS (ghostscript-9.22~dfsg+1-0ubuntu1.2) were impacted [1][2]. Gentoo also reported the vulnerability affecting versions before 9.26 [3].
Exploitation
To exploit this vulnerability, an attacker must be able to supply a specially crafted PostScript file to be processed by Ghostscript. This could be accomplished through various means, such as tricking a user into opening a malicious file or automated system processing untrusted documents. No authentication is required, and the attack can be launched remotely. The exploitation sequence involves the crafted PostScript triggering a stack exhaustion during exception handling, which causes the privilege restoration check to be bypassed, ultimately allowing the attacker to use the pipe instruction to execute arbitrary commands [1][2].
Impact
Successful exploitation of this vulnerability allows an attacker to execute arbitrary code with the privileges of the process running Ghostscript. This can lead to full compromise of the affected system, including unauthorized access to files, execution of arbitrary commands, and potential denial of service [2][3]. The impact is severe, as it can be leveraged to achieve remote code execution without requiring prior access or authentication.
Mitigation
The vulnerability is fixed in Ghostscript version 9.25 [1]. Red Hat released updated packages in RHSA-2018:3834 (ghostscript-9.07-31.el7_6.6) [1]. Ubuntu released fixed version 9.22~dfsg+1-0ubuntu1.2 for 18.04 LTS in USN-3768-1 [2]. Gentoo recommends upgrading to ghostscript-gpl-9.26 or later [3]. Users should update their Ghostscript installations to the patched versions as soon as possible. There are no known workarounds for this vulnerability [3].
AI Insight generated on May 26, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
16- Range: <9.25
- osv-coords15 versionspkg:rpm/opensuse/ghostscript&distro=openSUSE%20Tumbleweedpkg:rpm/suse/ghostscript&distro=SUSE%20Enterprise%20Storage%204pkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Desktop%2012%20SP3pkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015pkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP1-LTSSpkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP2-BCLpkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP2-LTSSpkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP3pkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Server%2012-LTSSpkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP1pkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP2pkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP3pkg:rpm/suse/ghostscript&distro=SUSE%20Linux%20Enterprise%20Software%20Development%20Kit%2012%20SP3pkg:rpm/suse/ghostscript&distro=SUSE%20OpenStack%20Cloud%207pkg:rpm/suse/libspectre&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Desktop%20Applications%2015
< 9.54.0-2.2+ 14 more
- (no CPE)range: < 9.54.0-2.2
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-3.6.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 9.25-23.13.1
- (no CPE)range: < 0.2.8-3.2.1
Patches
0No patches discovered yet.
Vulnerability mechanics
No source-code context for this CVE — mechanics is only generated when we can read the actual fix diff. Without that, the four sections (root cause, attack vector, affected code, fix) would be speculation rather than analysis.
References
10- access.redhat.com/errata/RHSA-2018:3834mitrevendor-advisoryx_refsource_REDHAT
- security.gentoo.org/glsa/201811-12mitrevendor-advisoryx_refsource_GENTOO
- usn.ubuntu.com/3768-1/mitrevendor-advisoryx_refsource_UBUNTU
- www.debian.org/security/2018/dsa-4294mitrevendor-advisoryx_refsource_DEBIAN
- git.ghostscript.commitrex_refsource_MISC
- git.ghostscript.commitrex_refsource_MISC
- git.ghostscript.commitrex_refsource_CONFIRM
- lists.debian.org/debian-lts-announce/2018/09/msg00015.htmlmitremailing-listx_refsource_MLIST
- seclists.org/oss-sec/2018/q3/228mitremailing-listx_refsource_MLIST
- seclists.org/oss-sec/2018/q3/229mitrex_refsource_MISC
News mentions
0No linked articles in our index yet.