cbcvebase.
CVE-2018-16509
published 2018-12-03

CVE-2018-16509: It was found that RHSA-2018:2918 did not fully fix CVE-2018-16509. An attacker could possibly exploit another variant of the flaw and bypass the -dSAFER…

PriorityP183high7.8CVSS 3.0
AVLACLPRNUIRSUCHIHAH
ITWEXPLOITVulnCheck KEV
Exploited in the wild
EPSS
92.50%
99.8th percentile
It was found that RHSA-2018:2918 did not fully fix CVE-2018-16509. An attacker could possibly exploit another variant of the flaw and bypass the -dSAFER protection to, for example, execute arbitrary shell commands via a specially crafted PostScript document. This only affects ghostscript 9.07 as shipped with Red Hat Enterprise Linux 7.

Affected

26 ranges· showing 25
VendorProductVersion rangeFixed in
artifexghostscript< 9.259.25
artifexghostscript< 9.249.24
artifexghostscript
artifexghostscript
artifexghostscript>= 0 < 9.25~dfsg-19.25~dfsg-1
artifexghostscript>= 0 < 9.25~dfsg-19.25~dfsg-1
artifexghostscript>= 0 < 9.25~dfsg-19.25~dfsg-1
artifexghostscript>= 0 < 9.25~dfsg-19.25~dfsg-1
artifexgpl_ghostscript< 9.269.26
canonicalubuntu_linux
canonicalubuntu_linux
canonicalubuntu_linux
debiandebian_linux
debiandebian_linux
debianghostscript< ghostscript 9.25~dfsg-1 (bookworm)ghostscript 9.25~dfsg-1 (bookworm)
debianghostscript
redhatenterprise_linux_desktop
redhatenterprise_linux_desktop
redhatenterprise_linux_server
redhatenterprise_linux_server
redhatenterprise_linux_server_aus
redhatenterprise_linux_server_eus
redhatenterprise_linux_server_eus
redhatenterprise_linux_server_tus
redhatenterprise_linux_workstation

Detection & IOCsextracted from sources · hover to see the quote

filenamemsf.ps
pathdata/exploits/ghostscript/msf.ps
urlhttp://seclists.org/oss-sec/2018/q3/142
urlhttps://bugs.chromium.org/p/project-zero/issues/detail?id=1640
  • CVE-2018-16509 exploits a -dSAFER bypass in Ghostscript via a failed restore (grestore) in PostScript to disable LockSafetyParams and avoid invalidaccess, enabling arbitrary command execution via the 'pipe' instruction.
  • The vulnerability is reachable via libraries such as ImageMagick that invoke Ghostscript; monitor for Ghostscript process spawning from image-processing services.
  • Detect specially crafted PostScript (.ps) files submitted to services that invoke Ghostscript; the exploit payload is embedded in a PostScript document.
  • CVE-2018-16802 (incomplete fix for CVE-2018-16509) abuses the 'pipe' instruction in PostScript; alert on Ghostscript processes executing pipe-based commands.
  • Ghostscript versions before 9.25 are vulnerable; flag invocations of ghostscript 9.07 as shipped with Red Hat Enterprise Linux 7 even after RHSA-2018:2918 patching.
  • The Metasploit module targets Unix (in-memory CMD), PowerShell (in-memory), and Linux (dropper) platforms; dropper payloads are written to a writable directory (default /tmp).
  • ·CVE-2018-16802 is also an incomplete fix for CVE-2018-16509; fixed in Ghostscript 9.25~dfsg-1 on Debian.
  • ·The Metasploit module payload space for the Unix in-memory target is capped at 4089 bytes (4096 total); larger payloads require the dropper target.

CVSS provenance

nvdv3.07.8HIGHCVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
nvdv2.09.3CRITICALAV:N/AC:M/Au:N/C:C/I:C/A:C
osv7.8HIGH
vulncheck7.8HIGH
vendor_debian7.8LOW
vendor_redhat7.8HIGH
CVEs like this are exactly what “Exploited This Week” covers.

Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.