#
# This script was written by Georges Dagousset <georges.dagousset@alert4web.com>
#
# See the Nessus Scripts License for details
#

if(description)
{
 script_id(10816); 
 script_bugtraq_id(3473);
 script_version("$Revision: 7592 $");
 script_tag(name:"cvss_base", value:"7.5");
 script_tag(name:"risk_factor", value:"High");
 script_cve_id("CVE-2001-0835");
 name = "Webalizer Cross Site Scripting Vulnerability";
 script_name(name);

 desc = "Webalizer have a cross-site scripting vulnerability,
that could allow malicious HTML tags to be injected
in the reports generated by the Webalizer.

Solution:
Upgrade to Version 2.01-09 and change the directory in 'OutputDir'
Risk factor : High";

 script_description(desc);

 summary = "Checks for the Webalizer version";
 script_summary(summary);

 script_category(ACT_GATHER_INFO);

 script_copyright("This script is Copyright (C) 2001 Alert4Web.com");
 family = "Gain a shell remotely";
 script_family(family);

 script_dependencie("http_version.nasl");
 script_require_ports("Services/www", 80);
 exit(0);
}

#
# The script code starts here
#

include("http_func.inc");
include("http_keepalive.inc");


dir[0] = "/usage/";	#Standard directory
dir[1] = "/webalizer/";	#Popular directory

port = get_http_port(default:80);


if (get_port_state(port))
{
 for (i = 0; dir[i] ; i = i + 1)
 {
  req = http_get(item:dir[i], port:port);
  buf = http_keepalive_send_recv(port:port, data:req);
  if ("Generated by The Webalizer" >< buf)
   {
    if (egrep(pattern:"Generated by The Webalizer  Ver(\.|sion) ([01]\.|2\.00|2\.01( |\-0[0-6]))", string:buf))
    {
     security_hole(port:port);
    }
    exit(0);
   }
 }
}

