FreeBSD : tomcat -- Remote Code Execution (c0dae634-4820-4505-850d-b1c975d0f67d) - Nessus

High   Plugin ID: 103718

This page contains detailed information about the FreeBSD : tomcat -- Remote Code Execution (c0dae634-4820-4505-850d-b1c975d0f67d) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 103718
Name: FreeBSD : tomcat -- Remote Code Execution (c0dae634-4820-4505-850d-b1c975d0f67d)
Filename: freebsd_pkg_c0dae63448204505850db1c975d0f67d.nasl
Vulnerability Published: 2017-10-04
This Plugin Published: 2017-10-09
Last Modification Time: 2022-03-28
Plugin Version: 3.12
Plugin Type: local
Plugin Family: FreeBSD Local Security Checks
Dependencies: ssh_get_info.nasl
Required KB Items [?]: Host/FreeBSD/pkg_info, Host/FreeBSD/release, Host/local_checks_enabled

Vulnerability Information


Severity: High
Vulnerability Published: 2017-10-04
Patch Published: 2017-10-06
CVE [?]: CVE-2017-12617
CPE [?]: cpe:/o:freebsd:freebsd, p-cpe:/a:freebsd:freebsd:tomcat

Synopsis

The remote FreeBSD host is missing one or more security-related updates.

Description

tomcat developers reports :

When running Apache Tomcat versions 9.0.0.M1 to 9.0.0, 8.5.0 to 8.5.22, 8.0.0.RC1 to 8.0.46 and 7.0.0 to 7.0.81 with HTTP PUTs enabled (e.g. via setting the readonly initialisation parameter of the Default servlet to false) it was possible to upload a JSP file to the server via a specially crafted request. This JSP could then be requested and any code it contained would be executed by the server.

Solution

Update the affected packages.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the FreeBSD : tomcat -- Remote Code Execution (c0dae634-4820-4505-850d-b1c975d0f67d) vulnerability:

  1. Metasploit: exploit/multi/http/tomcat_jsp_upload_bypass
    [Tomcat RCE via JSP Upload Bypass]
  2. Exploit-DB: exploits/java/remote/43008.rb
    [EDB-43008: Tomcat - Remote Code Execution via JSP Upload Bypass (Metasploit)]
  3. Exploit-DB: exploits/windows/webapps/42953.txt
    [EDB-42953: Apache Tomcat < 9.0.1 (Beta) / < 8.5.23 / < 8.0.47 / < 7.0.8 - JSP Upload Bypass / Remote Code Execution (1)]
  4. Exploit-DB: exploits/jsp/webapps/42966.py
    [EDB-42966: Apache Tomcat < 9.0.1 (Beta) / < 8.5.23 / < 8.0.47 / < 7.0.8 - JSP Upload Bypass / Remote Code Execution (2)]
  5. GitHub: https://github.com/3vikram/Application-Vulnerabilities-Payloads
    [CVE-2017-12617]
  6. GitHub: https://github.com/84KaliPleXon3/Payloads_All_The_Things
    [CVE-2017-12617]
  7. GitHub: https://github.com/1120362990/vulnerability-list
    [CVE-2017-12617]
  8. GitHub: https://github.com/Cyberleet1337/Payloadswebhack
    [CVE-2017-12617]
  9. GitHub: https://github.com/Delishsploits/PayloadsAndMethodology
    [CVE-2017-12617]
  10. GitHub: https://github.com/DynamicDesignz/Alien-Framework
    [CVE-2017-12617]
  11. GitHub: https://github.com/GuynnR/Payloads
    [CVE-2017-12617]
  12. GitHub: https://github.com/Kaizhe/attacker
    [CVE-2017-12617]
  13. GitHub: https://github.com/Muhammd/Awesome-Payloads
    [CVE-2017-12617]
  14. GitHub: https://github.com/Prodject/Kn0ck
    [CVE-2017-12617]
  15. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2017-12617]
  16. GitHub: https://github.com/XPR1M3/Payloads_All_The_Things
    [CVE-2017-12617]
  17. GitHub: https://github.com/andrysec/PayloadsAllVulnerability
    [CVE-2017-12617]
  18. GitHub: https://github.com/anhtu97/PayloadAllEverything
    [CVE-2017-12617]
  19. GitHub: https://github.com/apkadmin/PayLoadsAll
    [CVE-2017-12617]
  20. GitHub: https://github.com/chanchalpatra/payload
    [CVE-2017-12617]
  21. GitHub: https://github.com/hktalent/myhktools
    [CVE-2017-12617]
  22. GitHub: https://github.com/ilmari666/cybsec
    [CVE-2017-12617]
  23. GitHub: https://github.com/jptr218/tc_hack
    [CVE-2017-12617: An implementation of CVE-2017-12617]
  24. GitHub: https://github.com/kk98kk0/Payloads
    [CVE-2017-12617]
  25. GitHub: https://github.com/koutto/jok3r-pocs
    [CVE-2017-12617]
  26. GitHub: https://github.com/maya6/-scan-
    [CVE-2017-12617]
  27. GitHub: https://github.com/mrhacker51/ReverseShellCommands
    [CVE-2017-12617]
  28. GitHub: https://github.com/oneplus-x/Sn1per
    [CVE-2017-12617]
  29. GitHub: https://github.com/ozkanbilge/Payloads
    [CVE-2017-12617]
  30. GitHub: https://github.com/qiantu88/CVE-2017-12617
    [CVE-2017-12617]
  31. GitHub: https://github.com/scxiaotan1/Docker
    [CVE-2017-12617]
  32. GitHub: https://github.com/sobinge/PayloadsAllThesobinge
    [CVE-2017-12617]
  33. GitHub: https://github.com/sobinge/--1
    [CVE-2017-12617]
  34. GitHub: https://github.com/tyranteye666/tomcat-cve-2017-12617
    [CVE-2017-12617: Apache Tomcat < 9.0.1 (Beta) / < 8.5.23 / < 8.0.47 / < 7.0.8 - JSP Upload Bypass / ...]
  35. GitHub: https://github.com/unusualwork/Sn1per
    [CVE-2017-12617]
  36. GitHub: https://github.com/woods-sega/woodswiki
    [CVE-2017-12617]
  37. GitHub: https://github.com/ycdxsb/Exploits
    [CVE-2017-12617]
  38. GitHub: https://github.com/ygouzerh/CVE-2017-12617
    [CVE-2017-12617: Proof of Concept - RCE Exploitation : Web Shell on Apache Tomcat - Ensimag January ...]
  39. GitHub: http://www.freebuf.com/vuls/150203.html
    [CVE-2017-12617]
  40. GitHub: https://github.com/cyberheartmi9/CVE-2017-12617
    [CVE-2017-12617: Apache Tomcat < 9.0.1 (Beta) / < 8.5.23 / < 8.0.47 / < 7.0.8 - JSP Upload Bypass / ...]
  41. GitHub: https://github.com/devcoinfet/CVE-2017-12617
    [CVE-2017-12617: Code put together from a few peoples ideas credit given don't use maliciously please ...]
  42. GitHub: https://github.com/LongWayHomie/CVE-2017-12617
    [CVE-2017-12617: CVE-2017-12617 is a critical vulnerability leading to Remote Code Execution (RCE) in ...]
  43. GitHub: https://github.com/zi0Black/POC-CVE-2017-12615-or-CVE-2017-12717
    [CVE-2017-12617: CVE-2017-12617 and CVE-2017-12615 for tomcat server]
  44. D2 Elliot: apache_tomcat_for_windows_http_put_method_file_upload.html
    [Apache Tomcat for Windows HTTP PUT Method File Upload]

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:P/I:P/A:P/E:F/RL:OF/RC:C
CVSS Base Score:6.8 (Medium)
Impact Subscore:6.4
Exploitability Subscore:8.6
CVSS Temporal Score:5.6 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:5.6 (Medium)
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 freebsd_pkg_c0dae63448204505850db1c975d0f67d.nasl nessus plugin source code. This script is Copyright (C) 2017-2022 and is owned by Tenable, Inc. or an Affiliate thereof.

#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#
# The descriptive text and package checks in this plugin were  
# extracted from the FreeBSD VuXML database :
#
# Copyright 2003-2019 Jacques Vidrine and contributors
#
# Redistribution and use in source (VuXML) and 'compiled' forms (SGML,
# HTML, PDF, PostScript, RTF and so forth) with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source code (VuXML) must retain the above
#    copyright notice, this list of conditions and the following
#    disclaimer as the first lines of this file unmodified.
# 2. Redistributions in compiled form (transformed to other DTDs,
#    published online in any format, converted to PDF, PostScript,
#    RTF and other formats) must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer
#    in the documentation and/or other materials provided with the
#    distribution.
# 
# THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

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

if (description)
{
  script_id(103718);
  script_version("3.12");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/03/28");

  script_cve_id("CVE-2017-12617");
  script_xref(name:"CISA-KNOWN-EXPLOITED", value:"2022/04/15");

  script_name(english:"FreeBSD : tomcat -- Remote Code Execution (c0dae634-4820-4505-850d-b1c975d0f67d)");

  script_set_attribute(attribute:"synopsis", value:
"The remote FreeBSD host is missing one or more security-related
updates.");
  script_set_attribute(attribute:"description", value:
"tomcat developers reports :

When running Apache Tomcat versions 9.0.0.M1 to 9.0.0, 8.5.0 to
8.5.22, 8.0.0.RC1 to 8.0.46 and 7.0.0 to 7.0.81 with HTTP PUTs enabled
(e.g. via setting the readonly initialisation parameter of the Default
servlet to false) it was possible to upload a JSP file to the server
via a specially crafted request. This JSP could then be requested and
any code it contained would be executed by the server.");
  script_set_attribute(attribute:"see_also", value:"https://www.securityfocus.com/bid/100954");
  # https://lists.apache.org/thread.html/3fd341a604c4e9eab39e7eaabbbac39c30101a022acc11dd09d7ebcb@%3Cannounce.tomcat.apache.org%3E
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?4f047e41");
  # https://vuxml.freebsd.org/freebsd/c0dae634-4820-4505-850d-b1c975d0f67d.html
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?c19c7b76");
  script_set_attribute(attribute:"solution", value:
"Update the affected packages.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:P/I:P/A:P");
  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:"exploit_framework_core", value:"true");
  script_set_attribute(attribute:"d2_elliot_name", value:"Apache Tomcat for Windows HTTP PUT Method File Upload");
  script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Tomcat RCE via JSP Upload Bypass');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2017/10/04");
  script_set_attribute(attribute:"patch_publication_date", value:"2017/10/06");
  script_set_attribute(attribute:"plugin_publication_date", value:"2017/10/09");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:freebsd:freebsd:tomcat");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:freebsd:freebsd");
  script_set_attribute(attribute:"generated_plugin", value:"current");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"FreeBSD Local Security Checks");

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

  script_dependencies("ssh_get_info.nasl");
  script_require_keys("Host/local_checks_enabled", "Host/FreeBSD/release", "Host/FreeBSD/pkg_info");

  exit(0);
}


include("audit.inc");
include("freebsd_package.inc");


if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
if (!get_kb_item("Host/FreeBSD/release")) audit(AUDIT_OS_NOT, "FreeBSD");
if (!get_kb_item("Host/FreeBSD/pkg_info")) audit(AUDIT_PACKAGE_LIST_MISSING);


flag = 0;

if (pkg_test(save_report:TRUE, pkg:"tomcat>=7.0.0<=7.0.81")) flag++;
if (pkg_test(save_report:TRUE, pkg:"tomcat>=8.0.0<=8.0.46")) flag++;
if (pkg_test(save_report:TRUE, pkg:"tomcat>=8.5.0<=8.5.22")) flag++;
if (pkg_test(save_report:TRUE, pkg:"tomcat>=9.0.0<9.0.1")) flag++;

if (flag)
{
  if (report_verbosity > 0) security_warning(port:0, extra:pkg_report_get());
  else security_warning(0);
  exit(0);
}
else audit(AUDIT_HOST_NOT, "affected");

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

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

Go back to menu.

How to Run


Here is how to run the FreeBSD : tomcat -- Remote Code Execution (c0dae634-4820-4505-850d-b1c975d0f67d) 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 FreeBSD Local Security Checks plugin family.
  6. On the right side table select FreeBSD : tomcat -- Remote Code Execution (c0dae634-4820-4505-850d-b1c975d0f67d) plugin ID 103718.
  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 freebsd_pkg_c0dae63448204505850db1c975d0f67d.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


See also: Similar and related Nessus plugins:
  • 104179 - Amazon Linux AMI : tomcat8 / tomcat80,tomcat7 (ALAS-2017-913)
  • 104256 - CentOS 6 : tomcat6 (CESA-2017:3080)
  • 104257 - CentOS 7 : tomcat (CESA-2017:3081)
  • 104286 - EulerOS 2.0 SP1 : tomcat (EulerOS-SA-2017-1261)
  • 104287 - EulerOS 2.0 SP2 : tomcat (EulerOS-SA-2017-1262)
  • 105995 - Fedora 27 : 1:tomcat (2017-ebb76fc3c9)
  • 104505 - Fedora 26 : 1:tomcat (2017-ef7c118dbc)
  • 104506 - Fedora 25 : 1:tomcat (2017-f499ee7b12)
  • 106103 - MySQL Enterprise Monitor 3.3.x < 3.3.7.3306 / 3.4.x < 3.4.5.4248 / 4.0.x < 4.0.2.5168 Multiple Vulnerabilities (January 2018 CPU)
  • 127359 - NewStart CGSL MAIN 4.05 : tomcat6 Multiple Vulnerabilities (NS-SA-2019-0117)
  • 104765 - openSUSE Security Update : tomcat (openSUSE-2017-1299)
  • 106299 - Oracle Fusion Middleware Oracle HTTP Server Multiple Vulnerabilities (January 2018 CPU)
  • 104247 - Oracle Linux 6 : tomcat6 (ELSA-2017-3080)
  • 104248 - Oracle Linux 7 : tomcat (ELSA-2017-3081)
  • 106188 - Oracle Database Multiple Vulnerabilities (January 2018 CPU)
  • 109209 - Oracle WebCenter Sites Remote Vulnerability (April 2018 CPU)
  • 104250 - RHEL 6 : tomcat6 (RHSA-2017:3080)
  • 104251 - RHEL 7 : tomcat (RHSA-2017:3081)
  • 104456 - RHEL 6 / 7 : Red Hat JBoss Web Server (RHSA-2017:3113) (Optionsbleed)
  • 106650 - RHEL 7 : JBoss EAP (RHSA-2018:0268)
  • 106651 - RHEL 6 : JBoss EAP (RHSA-2018:0270)
  • 106616 - RHEL 6 : jboss-ec2-eap (RHSA-2018:0275)
  • 107208 - RHEL 6 / 7 : Red Hat JBoss Web Server 3.1.0 Service Pack 2 (RHSA-2018:0466)
  • 104268 - Scientific Linux Security Update : tomcat6 on SL6.x (noarch) (20171030)
  • 104269 - Scientific Linux Security Update : tomcat on SL7.x (noarch) (20171030)
  • 106349 - Oracle iPlanet Web Server 7.0.x < 7.0.27 NSS Unspecified Vulnerability (January 2018 CPU)
  • 150565 - SUSE SLES11 Security Update : tomcat6 (SUSE-SU-2021:14705-1)
  • 104358 - Apache Tomcat 6.0.x < 6.0.24 Multiple Vulnerabilities
  • 103782 - Apache Tomcat 7.0.x < 7.0.82 Multiple Vulnerabilities
  • 103697 - Apache Tomcat 8.0.0.RC1 < 8.0.47 Multiple Vulnerabilities
  • 103698 - Apache Tomcat 7.0.x < 7.0.82 / 8.5.x < 8.5.23 Multiple Vulnerabilities
  • 103699 - Apache Tomcat 9.0.0.M1 < 9.0.1 Multiple Vulnerabilities
  • 105006 - Apache Tomcat HTTP PUT JSP File Upload RCE
  • 110264 - Ubuntu 14.04 LTS / 16.04 LTS / 17.10 / 18.04 LTS : Tomcat vulnerabilities (USN-3665-1)
  • 119237 - Virtuozzo 6 : tomcat6 / tomcat6-admin-webapps / etc (VZLSA-2017-3080)

Version


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

Go back to menu.