Amazon Linux AMI : tomcat8 (ALAS-2019-1208) - Nessus

High   Plugin ID: 125294

This page contains detailed information about the Amazon Linux AMI : tomcat8 (ALAS-2019-1208) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 125294
Name: Amazon Linux AMI : tomcat8 (ALAS-2019-1208)
Filename: ala_ALAS-2019-1208.nasl
Vulnerability Published: 2018-10-04
This Plugin Published: 2019-05-21
Last Modification Time: 2019-07-03
Plugin Version: 1.3
Plugin Type: local
Plugin Family: Amazon Linux Local Security Checks
Dependencies: ssh_get_info.nasl
Required KB Items [?]: Host/AmazonLinux/release, Host/AmazonLinux/rpm-list, Host/local_checks_enabled

Vulnerability Information


Severity: High
Vulnerability Published: 2018-10-04
Patch Published: 2019-05-20
CVE [?]: CVE-2018-11784, CVE-2019-0199, CVE-2019-0232
CPE [?]: cpe:/o:amazon:linux, p-cpe:/a:amazon:linux:tomcat8, p-cpe:/a:amazon:linux:tomcat8-admin-webapps, p-cpe:/a:amazon:linux:tomcat8-docs-webapp, p-cpe:/a:amazon:linux:tomcat8-el-3.0-api, p-cpe:/a:amazon:linux:tomcat8-javadoc, p-cpe:/a:amazon:linux:tomcat8-jsp-2.3-api, p-cpe:/a:amazon:linux:tomcat8-lib, p-cpe:/a:amazon:linux:tomcat8-log4j, p-cpe:/a:amazon:linux:tomcat8-servlet-3.1-api, p-cpe:/a:amazon:linux:tomcat8-webapps

Synopsis

The remote Amazon Linux AMI host is missing a security update.

Description

When the default servlet in Apache Tomcat returned a redirect to a directory (e.g. redirecting to '/foo/' when the user requested '/foo') a specially crafted URL could be used to cause the redirect to be generated to any URI of the attackers choice. (CVE-2018-11784)

When running on Windows with enableCmdLineArguments enabled, the CGI Servlet in Apache Tomcat is vulnerable to Remote Code Execution due to a bug in the way the JRE passes command line arguments to Windows. The CGI Servlet is disabled by default. The CGI option enableCmdLineArguments is disable by default in Tomcat 9.0.x (and will be disabled by default in all versions in response to this vulnerability). For a detailed explanation of the JRE behaviour, see Markus Wulftange's blog (https://codewhitesec.blogspot.com/2016/02/java-and-command-line-injec tions-in-windows.html) and this archived MSDN blog (https://web.archive.org/web/20161228144344/https://blogs.msdn.microso ft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command -line-arguments-the-wrong-way/). (CVE-2019-0232)

The HTTP/2 implementation in Apache Tomcat accepted streams with excessive numbers of SETTINGS frames and also permitted clients to keep streams open without reading/writing request/response data. By keeping streams open for requests that utilised the Servlet API's blocking I/O, clients were able to cause server-side threads to block eventually leading to thread exhaustion and a DoS. (CVE-2019-0199)

Solution

Run 'yum update tomcat8' to update your system.

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 Amazon Linux AMI : tomcat8 (ALAS-2019-1208) 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/50118.txt
    [EDB-50118: Apache Tomcat 9.0.0.M1 - Open Redirect]
  4. GitHub: https://github.com/ilmari666/cybsec
    [CVE-2018-11784]
  5. GitHub: http://www.zhutougg.com/2018/10/08/cve-2018-11784-tomcat-urltiao-zhuan-lou-dong/
    [CVE-2018-11784]
  6. GitHub: https://github.com/ilmari666/cybsec
    [CVE-2019-0199]
  7. GitHub: https://blog.trendmicro.com/trendlabs-security-intelligence/uncovering-cve-2019-0232-a-remote-code-execution-vulnerability-in-apache-tomcat/
    [CVE-2019-0232]
  8. GitHub: https://github.com/0xmanjoos/CVE-2019-0232
    [CVE-2019-0232: Apache Tomcat CGIServlet RCE]
  9. GitHub: https://github.com/CherishHair/CVE-2019-0232-EXP
    [CVE-2019-0232]
  10. GitHub: https://github.com/Nicoslo/Windows-Exploitation-Web-Server-Tomcat-8.5.39-CVE-2019-0232
    [CVE-2019-0232]
  11. GitHub: https://github.com/Nicoslo/Windows-exploitation-Apache-Tomcat-8.5.19-CVE-2019-0232-
    [CVE-2019-0232]
  12. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2019-0232]
  13. GitHub: https://github.com/flyme2bluemoon/thm-advent
    [CVE-2019-0232]
  14. GitHub: https://github.com/ilmari666/cybsec
    [CVE-2019-0232]
  15. GitHub: https://github.com/jaiguptanick/CVE-2019-0232
    [CVE-2019-0232: Vulnerability analysis and PoC for the Apache Tomcat - CGIServlet ...]
  16. GitHub: https://github.com/lp008/Hack-readme
    [CVE-2019-0232]
  17. GitHub: https://github.com/r0eXpeR/redteam_vul
    [CVE-2019-0232]
  18. GitHub: https://github.com/safe6Sec/PentestNote
    [CVE-2019-0232]
  19. GitHub: https://github.com/starnightcyber/vul-info-collect
    [CVE-2019-0232]
  20. GitHub: https://github.com/tdcoming/Vulnerability-engine
    [CVE-2019-0232]
  21. GitHub: https://github.com/woods-sega/woodswiki
    [CVE-2019-0232]
  22. GitHub: https://github.com/jas502n/CVE-2019-0232
    [CVE-2019-0232: Apache Tomcat Remote Code Execution on Windows - CGI-BIN]
  23. GitHub: https://github.com/pyn3rd/CVE-2019-0232
    [CVE-2019-0232: Apache Tomcat Remote Code Execution on Windows]
  24. 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 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 ala_ALAS-2019-1208.nasl nessus plugin source code. This script is Copyright (C) 2019 and is owned by Tenable, Inc. or an Affiliate thereof.

#
# (C) Tenable Network Security, Inc.
#
# The descriptive text and package checks in this plugin were
# extracted from Amazon Linux AMI Security Advisory ALAS-2019-1208.
#

include("compat.inc");

if (description)
{
  script_id(125294);
  script_version("1.3");
  script_cvs_date("Date: 2019/07/03 12:01:40");

  script_cve_id("CVE-2018-11784", "CVE-2019-0199", "CVE-2019-0232");
  script_xref(name:"ALAS", value:"2019-1208");

  script_name(english:"Amazon Linux AMI : tomcat8 (ALAS-2019-1208)");
  script_summary(english:"Checks rpm output for the updated packages");

  script_set_attribute(
    attribute:"synopsis", 
    value:"The remote Amazon Linux AMI host is missing a security update."
  );
  script_set_attribute(
    attribute:"description", 
    value:
"When the default servlet in Apache Tomcat returned a redirect to a
directory (e.g. redirecting to '/foo/' when the user requested '/foo')
a specially crafted URL could be used to cause the redirect to be
generated to any URI of the attackers choice. (CVE-2018-11784)

When running on Windows with enableCmdLineArguments enabled, the CGI
Servlet in Apache Tomcat is vulnerable to Remote Code Execution due to
a bug in the way the JRE passes command line arguments to Windows. The
CGI Servlet is disabled by default. The CGI option
enableCmdLineArguments is disable by default in Tomcat 9.0.x (and will
be disabled by default in all versions in response to this
vulnerability). For a detailed explanation of the JRE behaviour, see
Markus Wulftange's blog
(https://codewhitesec.blogspot.com/2016/02/java-and-command-line-injec
tions-in-windows.html) and this archived MSDN blog
(https://web.archive.org/web/20161228144344/https://blogs.msdn.microso
ft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command
-line-arguments-the-wrong-way/). (CVE-2019-0232)

The HTTP/2 implementation in Apache Tomcat accepted streams with
excessive numbers of SETTINGS frames and also permitted clients to
keep streams open without reading/writing request/response data. By
keeping streams open for requests that utilised the Servlet API's
blocking I/O, clients were able to cause server-side threads to block
eventually leading to thread exhaustion and a DoS. (CVE-2019-0199)"
  );
  script_set_attribute(
    attribute:"see_also",
    value:"https://alas.aws.amazon.com/ALAS-2019-1208.html"
  );
  script_set_attribute(
    attribute:"solution", 
    value:"Run 'yum update tomcat8' to update your system."
  );
  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:"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:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-admin-webapps");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-docs-webapp");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-el-3.0-api");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-javadoc");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-jsp-2.3-api");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-lib");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-log4j");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-servlet-3.1-api");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:amazon:linux:tomcat8-webapps");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:amazon:linux");

  script_set_attribute(attribute:"vuln_publication_date", value:"2018/10/04");
  script_set_attribute(attribute:"patch_publication_date", value:"2019/05/20");
  script_set_attribute(attribute:"plugin_publication_date", value:"2019/05/21");
  script_set_attribute(attribute:"generated_plugin", value:"current");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_copyright(english:"This script is Copyright (C) 2019 and is owned by Tenable, Inc. or an Affiliate thereof.");
  script_family(english:"Amazon Linux Local Security Checks");

  script_dependencies("ssh_get_info.nasl");
  script_require_keys("Host/local_checks_enabled", "Host/AmazonLinux/release", "Host/AmazonLinux/rpm-list");

  exit(0);
}


include("audit.inc");
include("global_settings.inc");
include("rpm.inc");


if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);

release = get_kb_item("Host/AmazonLinux/release");
if (isnull(release) || !strlen(release)) audit(AUDIT_OS_NOT, "Amazon Linux");
os_ver = pregmatch(pattern: "^AL(A|\d)", string:release);
if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "Amazon Linux");
os_ver = os_ver[1];
if (os_ver != "A")
{
  if (os_ver == 'A') os_ver = 'AMI';
  audit(AUDIT_OS_NOT, "Amazon Linux AMI", "Amazon Linux " + os_ver);
}

if (!get_kb_item("Host/AmazonLinux/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING);


flag = 0;
if (rpm_check(release:"ALA", reference:"tomcat8-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-admin-webapps-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-docs-webapp-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-el-3.0-api-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-javadoc-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-jsp-2.3-api-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-lib-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-log4j-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-servlet-3.1-api-8.5.40-1.79.amzn1")) flag++;
if (rpm_check(release:"ALA", reference:"tomcat8-webapps-8.5.40-1.79.amzn1")) flag++;

if (flag)
{
  if (report_verbosity > 0) security_hole(port:0, extra:rpm_report_get());
  else security_hole(0);
  exit(0);
}
else
{
  tested = pkg_tests_get();
  if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
  else audit(AUDIT_PACKAGE_NOT_INSTALLED, "tomcat8 / tomcat8-admin-webapps / tomcat8-docs-webapp / etc");
}

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

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

Go back to menu.

How to Run


Here is how to run the Amazon Linux AMI : tomcat8 (ALAS-2019-1208) 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 Amazon Linux Local Security Checks plugin family.
  6. On the right side table select Amazon Linux AMI : tomcat8 (ALAS-2019-1208) plugin ID 125294.
  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 ala_ALAS-2019-1208.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a ala_ALAS-2019-1208.nasl -t <IP/HOST>

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

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

Go back to menu.

References


ALAS | Amazon Linux Security Advisory: See also: Similar and related Nessus plugins:
  • 118803 - Amazon Linux AMI : tomcat7 (ALAS-2018-1099)
  • 119540 - openSUSE Security Update : tomcat (openSUSE-2018-1504)
  • 121325 - RHEL 6 / 7 : Red Hat JBoss Web Server 3.1 Service Pack 6 (RHSA-2019:0131)
  • 121411 - openSUSE Security Update : virtualbox (openSUSE-2019-84)
  • 121601 - Oracle Secure Global Desktop Multiple Vulnerabilities (January 2019 CPU)
  • 122841 - RHEL 7 : tomcat (RHSA-2019:0485)
  • 122846 - Scientific Linux Security Update : tomcat on SL7.x (noarch) (20190313)
  • 122863 - Oracle Linux 7 : tomcat (ELSA-2019-0485)
  • 122953 - CentOS 7 : tomcat (CESA-2019:0485)
  • 123395 - openSUSE Security Update : tomcat (openSUSE-2019-972)
  • 124058 - Apache Tomcat 9.0.0.M1 < 9.0.19 Remote Code Execution Vulnerability (Windows)
  • 124063 - Apache Tomcat 8.5.0 < 8.5.40 Remote Code Execution Vulnerability (Windows)
  • 124064 - Apache Tomcat 7.0.0 < 7.0.94 Remote Code Execution Vulnerability (Windows)
  • 124127 - Amazon Linux 2 : tomcat (ALAS-2019-1192)
  • 124169 - Oracle Primavera P6 Enterprise Project Portfolio Management (EPPM) Multiple Vulnerabilities (Apr 2019 CPU)
  • 124170 - Oracle Primavera Unifier Multiple Vulnerabilities (Apr 2019 CPU)
  • 124862 - Photon OS 1.0: Apache PHSA-2019-1.0-0227
  • 125529 - EulerOS 2.0 SP5 : tomcat (EulerOS-SA-2019-1602)
  • 125844 - openSUSE Security Update : virtualbox (openSUSE-2019-1547)
  • 126030 - RHEL 8 : pki-deps:10.6 (RHSA-2019:1529)
  • 126125 - Apache Tomcat 8.5.0 < 8.5.41 DoS
  • 126225 - Fedora 30 : 1:tomcat (2019-1a3f878d27)
  • 126245 - Apache Tomcat 9.0.0.M1 < 9.0.20 DoS
  • 126312 - Apache Tomcat 9.0.0.M1 < 9.0.16 DoS
  • 126373 - openSUSE Security Update : tomcat (openSUSE-2019-1673)
  • 126483 - Fedora 29 : 1:tomcat (2019-d66febb5df)
  • 126888 - openSUSE Security Update : tomcat (openSUSE-2019-1723)
  • 127009 - EulerOS 2.0 SP8 : tomcat (EulerOS-SA-2019-1772)
  • 127062 - Amazon Linux AMI : tomcat8 (ALAS-2019-1234)
  • 127088 - openSUSE Security Update : tomcat (openSUSE-2019-1808)
  • 127250 - NewStart CGSL CORE 5.04 / MAIN 5.04 : tomcat Vulnerability (NS-SA-2019-0059)
  • 127594 - Oracle Linux 8 : pki-deps:10.6 (ELSA-2019-1529)
  • 127734 - openSUSE Security Update : virtualbox (openSUSE-2019-1814)
  • 128682 - Ubuntu 16.04 LTS / 18.04 LTS : Tomcat vulnerabilities (USN-4128-1)

Version


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

Go back to menu.