AWStats awstats.pl configdir Parameter Arbitrary Command Execution - Nessus

High   Plugin ID: 16189

This page contains detailed information about the AWStats awstats.pl configdir 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: 16189
Name: AWStats awstats.pl configdir Parameter Arbitrary Command Execution
Filename: awstats_configdir.nasl
Vulnerability Published: 2005-01-01
This Plugin Published: 2005-01-18
Last Modification Time: 2022-04-11
Plugin Version: 1.28
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: High
Vulnerability Published: 2005-01-01
Patch Published: N/A
CVE [?]: CVE-2005-0116
CPE [?]: cpe:/a:laurent_destailleur:awstats

Synopsis

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

Description

The remote host is running AWStats, a free logfile analysis tool for analyzing ftp, mail, web, ... traffic.

The remote version of this software fails to sanitize user-supplied input to the 'configdir' parameter of the 'awstats.pl' script. An attacker may exploit this condition to execute commands remotely or disclose contents of files, subject to the privileges under which the web server operates.

Solution

Upgrade to AWStats version 6.3 or later.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
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 AWStats awstats.pl configdir Parameter Arbitrary Command Execution vulnerability:

  1. Metasploit: exploit/unix/webapp/awstats_configdir_exec
    [AWStats configdir Remote Command Execution]
  2. Exploit-DB: exploits/cgi/webapps/9912.rb
    [EDB-9912: AWStats 6.2 < 6.1 - configdir Command Injection (Metasploit)]
  3. Exploit-DB: exploits/cgi/webapps/16905.rb
    [EDB-16905: AWStats 6.1 < 6.2 - 'configdir' Remote Command Execution (Metasploit)]
  4. GitHub: https://github.com/capturePointer/libxploit
    [CVE-2005-0116]

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:POC/RL:OF/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:5.9 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:5.9 (Medium)

Go back to menu.

Plugin Source


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

  script_cve_id("CVE-2005-0116");
  script_bugtraq_id(12270, 12298);

  script_name(english:"AWStats awstats.pl configdir Parameter Arbitrary Command Execution");

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

The remote version of this software fails to sanitize user-supplied
input to the 'configdir' parameter of the 'awstats.pl' script.  An
attacker may exploit this condition to execute commands remotely or
disclose contents of files, subject to the privileges under which the
web server operates.");
  # https://labs.idefense.com/verisign/intelligence/2009/vulnerabilities/display.php?id=185
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?2210a10f");
  script_set_attribute(attribute:"see_also", value:"http://www.awstats.org/docs/awstats_changelog.txt");
  script_set_attribute(attribute:"solution", value:
"Upgrade to AWStats version 6.3 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:POC/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:"metasploit_name", value:'AWStats configdir Remote Command Execution');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
  script_cwe_id(20);

  script_set_attribute(attribute:"vuln_publication_date", value:"2005/01/01");
  script_set_attribute(attribute:"plugin_publication_date", value:"2005/01/18");

  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) 2005-2022 Tenable Network Security, Inc.");

  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("global_settings.inc");
include("http_func.inc");
include("http_keepalive.inc");

port = get_http_port(default:80, embedded:TRUE);
if ( ! port ) exit(0, "Port "+port+" is closed");
if (get_kb_item("Services/www/"+port+"/embedded")) exit(0, "The web server on port "+port+" is embedded.");

# Test an install.
install = get_kb_item(string("www/", port, "/AWStats"));
if (isnull(install)) exit(0, "AWStats was not detected on port "+port);
matches = eregmatch(string:install, pattern:"^(.+) under (/.*)$");

if (!isnull(matches))
{ 
  dir = matches[2];
  http_check_remote_code_ka (
			extra_dirs:make_list(dir),
			extra_check:"Check config file, permissions and AWStats documentation",
			check_request:"/awstats.pl?configdir=|echo%20Content-Type:%20text/html;%20echo%20;id|%00",
			check_result:"uid=[0-9]+.*gid=[0-9]+.*",
			command:"id" );
}

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

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

Go back to menu.

How to Run


Here is how to run the AWStats awstats.pl configdir 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 awstats.pl configdir Parameter Arbitrary Command Execution plugin ID 16189.
  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_configdir.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: CWE | Common Weakness Enumeration:
  • CWE-20 (Weakness) Improper Input Validation
See also: Similar and related Nessus plugins:
  • 18840 - FreeBSD : awstats -- remote command execution vulnerability (0f5a2b4d-694b-11d9-a9e7-0001020eed82)
  • 16427 - GLSA-200501-36 : AWStats: Remote code execution
  • 21328 - AWStats migrate Parameter Arbitrary Command Execution
  • 34055 - AWStats Totals awstatstotals.php multisort() Function sort Parameter Arbitrary PHP Code Execution
  • 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)

Version


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

Go back to menu.