Artifex Ghostscript < 9.25 PostScript Code Execution Vulnerability - Nessus

High   Plugin ID: 117596

This page contains detailed information about the Artifex Ghostscript < 9.25 PostScript Code Execution Vulnerability Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 117596
Name: Artifex Ghostscript < 9.25 PostScript Code Execution Vulnerability
Filename: ghostscript_9_25.nasl
Vulnerability Published: 2018-09-03
This Plugin Published: 2018-09-19
Last Modification Time: 2019-04-05
Plugin Version: 1.4
Plugin Type: local
Plugin Family: Windows
Dependencies: ghostscript_detect.nbin
Required KB Items [?]: installed_sw/Ghostscript

Vulnerability Information


Severity: High
Vulnerability Published: 2018-09-03
Patch Published: 2018-09-13
CVE [?]: CVE-2018-16509, CVE-2018-16802
CPE [?]: cpe:/a:artifex:ghostscript, cpe:/a:artifex:gpl_ghostscript

Synopsis

The remote Windows host contains a library that is affected by multiple vulnerabilities.

Description

The version of Artifex Ghostscript installed on the remote Windows host is prior to 9.25. It is, therefore, affected by a code execution vulnerability.

Solution

Update to 9.25.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Artifex Ghostscript < 9.25 PostScript Code Execution Vulnerability vulnerability:

  1. Metasploit: exploit/multi/fileformat/ghostscript_failed_restore
    [Ghostscript Failed Restore Command Execution]
  2. Exploit-DB: exploits/linux/local/45369.rb
    [EDB-45369: Ghostscript - Failed Restore Command Execution (Metasploit)]
  3. GitHub: https://github.com/0xsyr0/OSCP
    [CVE-2018-16509]
  4. GitHub: https://github.com/AssassinUKG/CVE_2018_16509
    [CVE-2018-16509: exploit..]
  5. GitHub: https://github.com/NCSU-DANCE-Research-Group/CDL
    [CVE-2018-16509]
  6. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2018-16509]
  7. GitHub: https://github.com/barrracud4/image-upload-exploits
    [CVE-2018-16509]
  8. GitHub: https://github.com/rhpco/CVE-2018-16509
    [CVE-2018-16509: CVE-2018-16509 Docker Playground - Ghostscript command execution]
  9. GitHub: https://medium.com/@NumbShiva/imagemagic-rce-f364a9f50a14
    [CVE-2018-16509]
  10. GitHub: https://github.com/cved-sources/cve-2018-16509
    [CVE-2018-16509: Cve-2018-16509]
  11. GitHub: https://github.com/farisv/PIL-RCE-Ghostscript-CVE-2018-16509
    [CVE-2018-16509: PoC + Docker Environment for Python PIL/Pillow Remote Shell Command Execution via ...]
  12. GitHub: https://github.com/knqyf263/CVE-2018-16509
    [CVE-2018-16509: CVE-2018-16509 (Ghostscript contains multiple -dSAFER sandbox bypass vulnerabilities) ...]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS Score Source [?]: CVE-2018-16802
CVSS V2 Vector: AV:N/AC:M/Au:N/C:C/I:C/A:C/E:F/RL:OF/RC:C
CVSS Base Score:9.3 (High)
Impact Subscore:10.0
Exploitability Subscore:8.6
CVSS Temporal Score:7.7 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.7 (High)
CVSS V3 Vector: CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:7.8 (High)
Impact Subscore:5.9
Exploitability Subscore:1.8
CVSS Temporal Score:7.2 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.2 (High)

Go back to menu.

Plugin Source


This is the ghostscript_9_25.nasl nessus plugin source code. This script is Copyright (C) 2018-2019 and is owned by Tenable, Inc. or an Affiliate thereof.

#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(117596);
  script_version("1.4");
  script_cvs_date("Date: 2019/04/05 23:25:09");

  script_cve_id(
    "CVE-2018-16509",
    "CVE-2018-16802"
  );

  script_name(english:"Artifex Ghostscript < 9.25 PostScript Code Execution Vulnerability");
  script_summary(english:"Checks the Ghostscript version.");

  script_set_attribute(attribute:"synopsis", value:
"The remote Windows host contains a library that is affected by
multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"The version of Artifex Ghostscript installed on the remote Windows
host is prior to 9.25. It is, therefore, affected by a code 
execution vulnerability.");
  script_set_attribute(attribute:"see_also", value: "https://ghostscript.com/doc/9.25/History9.htm");
  script_set_attribute(attribute:"solution", value: "Update to 9.25.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2018-16802");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Ghostscript Failed Restore Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2018/09/03");
  script_set_attribute(attribute:"patch_publication_date", value:"2018/09/13");
  script_set_attribute(attribute:"plugin_publication_date", value:"2018/09/19");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:artifex:ghostscript");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:artifex:gpl_ghostscript");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Windows");

  script_copyright(english:"This script is Copyright (C) 2018-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("ghostscript_detect.nbin");
  script_require_keys("installed_sw/Ghostscript");

  exit(0);
}

include("vcf.inc");

app = "Ghostscript";
constraints = [{"fixed_version" : "9.25"}];

app_info = vcf::get_app_info(app:app, win_local:TRUE);

vcf::check_version_and_report(app_info:app_info, constraints:constraints, severity:SECURITY_HOLE);

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/ghostscript_9_25.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\ghostscript_9_25.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/ghostscript_9_25.nasl

Go back to menu.

How to Run


Here is how to run the Artifex Ghostscript < 9.25 PostScript Code Execution Vulnerability as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select Windows plugin family.
  6. On the right side table select Artifex Ghostscript < 9.25 PostScript Code Execution Vulnerability plugin ID 117596.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl ghostscript_9_25.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a ghostscript_9_25.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - ghostscript_9_25.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state ghostscript_9_25.nasl -t <IP/HOST>

Go back to menu.

References


See also: Similar and related Nessus plugins:
  • 100356 - Artifex Ghostscript .rsdparams Operator Handling Type Confusion RCE
  • 119240 - Artifex Ghostscript < 9.26 PostScript Multiple Vulnerabilities
  • 130273 - Artifex Ghostscript < 9.50 Multiple Vulnerabilities

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file ghostscript_9_25.nasl version 1.4. For more plugins, visit the Nessus Plugin Library.

Go back to menu.