Apache Tomcat 9.0.0.M1 < 9.0.19 Remote Code Execution Vulnerability (Windows) - Nessus

High   Plugin ID: 124058

This page contains detailed information about the Apache Tomcat 9.0.0.M1 < 9.0.19 Remote Code Execution Vulnerability (Windows) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 124058
Name: Apache Tomcat 9.0.0.M1 < 9.0.19 Remote Code Execution Vulnerability (Windows)
Filename: tomcat_9_0_18.nasl
Vulnerability Published: 2019-03-03
This Plugin Published: 2019-04-15
Last Modification Time: 2022-04-11
Plugin Version: 1.13
Plugin Type: combined
Plugin Family: Web Servers
Dependencies: apache_tomcat_nix_installed.nbin, os_fingerprint.nasl, tomcat_error_version.nasl, tomcat_win_installed.nbin
Required KB Items [?]: Host/OS, installed_sw/Apache Tomcat

Vulnerability Information


Severity: High
Vulnerability Published: 2019-03-03
Patch Published: 2019-04-13
CVE [?]: CVE-2019-0221, CVE-2019-0232
CPE [?]: cpe:/a:apache:tomcat

Synopsis

The remote Windows Apache Tomcat server is affected by a remote code execution vulnerability

Description

The version of Tomcat installed on the remote Windows host is prior to 9.0.19. It is, therefore, affected by a remote code execution vulnerability due to a bug in the way the JRE passes command line arguments to Windows. An unauthenticated, remote attacker can exploit this to execute arbitrary commands. Additionally, it is affected by a cross-site (XSS) scripting vulnerability as the SSI printenv command echoes user provided data without proper escaping.

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version number.

Solution

Upgrade to Apache Tomcat version 9.0.19 or later.

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 Apache Tomcat 9.0.0.M1 < 9.0.19 Remote Code Execution Vulnerability (Windows) vulnerability:

  1. Metasploit: exploit/windows/http/tomcat_cgi_cmdlineargs
    [Apache Tomcat CGIServlet enableCmdLineArguments Vulnerability]
  2. Exploit-DB: exploits/windows/remote/47073.rb
    [EDB-47073: Apache Tomcat - CGIServlet enableCmdLineArguments Remote Code Execution (Metasploit)]
  3. Exploit-DB: exploits/multiple/webapps/50119.txt
    [EDB-50119: Apache Tomcat 9.0.0.M1 - Cross-Site Scripting (XSS)]
  4. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2019-0221]
  5. GitHub: https://github.com/ilmari666/cybsec
    [CVE-2019-0221]
  6. GitHub: https://github.com/starnightcyber/vul-info-collect
    [CVE-2019-0221]
  7. GitHub: https://github.com/woods-sega/woodswiki
    [CVE-2019-0221]
  8. GitHub: https://blog.trendmicro.com/trendlabs-security-intelligence/uncovering-cve-2019-0232-a-remote-code-execution-vulnerability-in-apache-tomcat/
    [CVE-2019-0232]
  9. GitHub: https://github.com/0xmanjoos/CVE-2019-0232
    [CVE-2019-0232: Apache Tomcat CGIServlet RCE]
  10. GitHub: https://github.com/CherishHair/CVE-2019-0232-EXP
    [CVE-2019-0232]
  11. GitHub: https://github.com/Nicoslo/Windows-Exploitation-Web-Server-Tomcat-8.5.39-CVE-2019-0232
    [CVE-2019-0232]
  12. GitHub: https://github.com/Nicoslo/Windows-exploitation-Apache-Tomcat-8.5.19-CVE-2019-0232-
    [CVE-2019-0232]
  13. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2019-0232]
  14. GitHub: https://github.com/flyme2bluemoon/thm-advent
    [CVE-2019-0232]
  15. GitHub: https://github.com/ilmari666/cybsec
    [CVE-2019-0232]
  16. GitHub: https://github.com/jaiguptanick/CVE-2019-0232
    [CVE-2019-0232: Vulnerability analysis and PoC for the Apache Tomcat - CGIServlet ...]
  17. GitHub: https://github.com/lp008/Hack-readme
    [CVE-2019-0232]
  18. GitHub: https://github.com/r0eXpeR/redteam_vul
    [CVE-2019-0232]
  19. GitHub: https://github.com/safe6Sec/PentestNote
    [CVE-2019-0232]
  20. GitHub: https://github.com/starnightcyber/vul-info-collect
    [CVE-2019-0232]
  21. GitHub: https://github.com/tdcoming/Vulnerability-engine
    [CVE-2019-0232]
  22. GitHub: https://github.com/woods-sega/woodswiki
    [CVE-2019-0232]
  23. GitHub: https://github.com/jas502n/CVE-2019-0232
    [CVE-2019-0232: Apache Tomcat Remote Code Execution on Windows - CGI-BIN]
  24. GitHub: https://github.com/pyn3rd/CVE-2019-0232
    [CVE-2019-0232: Apache Tomcat Remote Code Execution on Windows]
  25. GitHub: https://github.com/setrus/CVE-2019-0232
    [CVE-2019-0232: CVE-2019-0232-Remote Code Execution on Apache Tomcat 7.0.42]

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-2019-0232
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:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:8.1 (High)
Impact Subscore:5.9
Exploitability Subscore:2.2
CVSS Temporal Score:7.5 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:7.5 (High)

Go back to menu.

Plugin Source


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

#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(124058);
  script_version("1.13");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2019-0221", "CVE-2019-0232");
  script_bugtraq_id(107906);

  script_name(english:"Apache Tomcat 9.0.0.M1 < 9.0.19 Remote Code Execution Vulnerability (Windows)");

  script_set_attribute(attribute:"synopsis", value:
"The remote Windows Apache Tomcat server is affected by a remote code execution vulnerability");
  script_set_attribute(attribute:"description", value:
"The version of Tomcat installed on the remote Windows host is prior to 9.0.19. It is, therefore, affected by a remote
code execution vulnerability due to a bug in the way the JRE passes command line arguments to Windows. An 
unauthenticated, remote attacker can exploit this to execute arbitrary commands. 
Additionally, it is affected by a cross-site (XSS) scripting vulnerability as the SSI printenv command echoes user
provided data without proper escaping.

Note that Nessus has not tested for this issue but has instead relied
only on the application's self-reported version number.");
  script_set_attribute(attribute:"see_also", value:"https://github.com/apache/tomcat/commit/4b244d8");
  # https://tomcat.apache.org/security-9.html#Fixed_in_Apache_Tomcat_9.0.19
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?387f17bf");
  script_set_attribute(attribute:"solution", value:
"Upgrade to Apache Tomcat version 9.0.19 or later.");
  script_set_attribute(attribute:"agent", value:"all");
  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:N/AC:H/PR:N/UI:N/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-2019-0232");

  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:'Apache Tomcat CGIServlet enableCmdLineArguments Vulnerability');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2019/03/03");
  script_set_attribute(attribute:"patch_publication_date", value:"2019/04/13");
  script_set_attribute(attribute:"plugin_publication_date", value:"2019/04/15");

  script_set_attribute(attribute:"plugin_type", value:"combined");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:apache:tomcat");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Web Servers");

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

  script_dependencies("tomcat_error_version.nasl", "os_fingerprint.nasl", "tomcat_win_installed.nbin", "apache_tomcat_nix_installed.nbin");
  script_require_keys("installed_sw/Apache Tomcat", "Host/OS");

  exit(0);
}

include("tomcat_version.inc");

# Vuln only on Windows
os = get_kb_item_or_exit('Host/OS');
if ('Windows' >!< os) audit(AUDIT_OS_NOT, 'Windows', os);

conf = get_kb_item('Host/OS/Confidence');
if ((conf <= 70) && (report_paranoia < 2 )) 
{
  exit(1, 'Can\'t determine the host\'s OS with sufficient confidence and \'show potential false alarms\' is not enabled.');
}
tomcat_check_version(fixed: '9.0.19', min:'9.0.0.M1', severity:SECURITY_HOLE, granularity_regex: "^9(\.0)?$", xss:TRUE);

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

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

Go back to menu.

How to Run


Here is how to run the Apache Tomcat 9.0.0.M1 < 9.0.19 Remote Code Execution Vulnerability (Windows) 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 Web Servers plugin family.
  6. On the right side table select Apache Tomcat 9.0.0.M1 < 9.0.19 Remote Code Execution Vulnerability (Windows) plugin ID 124058.
  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 tomcat_9_0_18.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

/opt/nessus/bin/nasl -T - tomcat_9_0_18.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 tomcat_9_0_18.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 125294 - Amazon Linux AMI : tomcat8 (ALAS-2019-1208)
  • 127062 - Amazon Linux AMI : tomcat8 (ALAS-2019-1234)
  • 127063 - Amazon Linux AMI : tomcat7 (ALAS-2019-1235)
  • 125606 - Debian DLA-1810-1 : tomcat7 security update
  • 127865 - Debian DLA-1883-1 : tomcat8 security update (httpoxy)
  • 132427 - Debian DSA-4596-1 : tomcat8 - security update
  • 128188 - EulerOS 2.0 SP8 : tomcat (EulerOS-SA-2019-1819)
  • 128808 - EulerOS 2.0 SP5 : tomcat (EulerOS-SA-2019-1885)
  • 129240 - EulerOS 2.0 SP3 : tomcat (EulerOS-SA-2019-2047)
  • 131853 - EulerOS 2.0 SP2 : tomcat (EulerOS-SA-2019-2361)
  • 126225 - Fedora 30 : 1:tomcat (2019-1a3f878d27)
  • 126483 - Fedora 29 : 1:tomcat (2019-d66febb5df)
  • 134729 - GLSA-202003-43 : Apache Tomcat: Multiple vulnerabilities
  • 126373 - openSUSE Security Update : tomcat (openSUSE-2019-1673)
  • 127088 - openSUSE Security Update : tomcat (openSUSE-2019-1808)
  • 148980 - Oracle Business Intelligence Publisher Multiple Vulnerabilities (Apr 2021 CPU)
  • 131214 - RHEL 6 / 7 / 8 : JBoss Web Server (RHSA-2019:3929)
  • 134668 - RHEL 6 : Red Hat JBoss Web Server 3.1 Service Pack 8 (RHSA-2020:0861)
  • 150581 - SUSE SLES11 Security Update : tomcat6 (SUSE-SU-2020:14375-1)
  • 124064 - Apache Tomcat 7.0.0 < 7.0.94 Remote Code Execution Vulnerability (Windows)
  • 124063 - Apache Tomcat 8.5.0 < 8.5.40 Remote Code Execution Vulnerability (Windows)
  • 128682 - Ubuntu 16.04 LTS / 18.04 LTS : Tomcat vulnerabilities (USN-4128-1)
  • 129048 - Ubuntu 18.04 LTS / 19.04 : Tomcat vulnerabilities (USN-4128-2)

Version


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

Go back to menu.