Bug 103788 (CVE-2005-1527)

Summary: VUL-0: CVE-2005-1527: awstats showinfourl rce
Product: [Novell Products] SUSE Security Incidents Reporter: Sebastian Krahmer <krahmer>
Component: IncidentsAssignee: Sebastian Krahmer <krahmer>
Status: RESOLVED FIXED QA Contact: Security Team bot <security-team>
Severity: Normal    
Priority: P5 - None CC: security-team
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: All   
Whiteboard: CVE-2005-1527: CVSS v2 Base Score: 5.0 (AV:N/AC:L/Au:N/C:N/I:P/A:N)
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: patchinfo

Description Sebastian Krahmer 2005-08-10 11:43:03 UTC
AWStats ShowInfoURL Remote Command Execution Vulnerability

iDEFENSE Security Advisory 08.09.05
www.idefense.com/application/poi/display?id=290&type=vulnerabilities
August 09, 2005

I. BACKGROUND

AWStats is a free tool that generates web, streaming, ftp or mail
server statistics, graphically. It can analyze log files from all major
server tools like Apache log files (NCSA combined/XLF/ELF log format or
common/CLF log format), WebStar, IIS (W3C log format) and other web,
proxy, wap, streaming servers, mail servers and some ftp servers. More
information is available at the vendor's website:

     http://awstats.sourceforge.net

II. DESCRIPTION

Remote exploitation of an input validation vulnerability in AWStats
allows remote attackers to execute arbitrary commands.

AWStats is a logfile analysis tool that generates reports for ftp, mail
and web traffic. The problem specifically exists because of
insufficient input filtering before passing user-supplied data to an
eval() function. As part of the statistics reporting function, AWStats
displays information about the most common referrer values that caused
users to visit the website. The referrer data is used without proper
sanitation in an eval() statement, resulting in the execution of
arbitrary perl code.

Shown as follows, the $url parameter contains unfiltered user-supplied
data that is used in a call to the Perl routine eval() on lines 4841
and 4842 of awstats.pl (version 6.4):

     my $function="ShowInfoURL_$pluginname('$url')";
     eval("$function");

The malicious referrer value will be included in the referrer
statistics portion of the AWStats report after AWStats has been run to
generate a new report including the tainted data. Once a user visits
the referrer statistics page, the injected perl code will execute with
permissions of the web service.

III. ANALYSIS

Successful exploitation results in the execution of arbitrary commands
with permissions of the web service. Exploitation will not occur until
the stats page has been regenerated with the tainted referrer values
from the http access log. Note that AWStats is only vulnerable in
situations where at least one URLPlugin is enabled.

AWStats is a very commonly used web statistics reporting package. Since
this attack does not require special privileges, it is recommended that
users update AWStats to the latest available package.

IV. DETECTION

iDEFENSE Labs has confirmed the existence of this vulnerability in
AWStats 6.3. All earlier versions are suspected vulnerable. AWStats 6.4
has been released since the initial research on this vulnerability.
AWStats 6.4 has replaced all eval() statements, and has mitigated the
exposure to this vulnerability.

V. WORKAROUND

As a workaround solution, disable all URLPlugins in the AWStats
configuration.

VI. VENDOR RESPONSE

This vulnerability has been addressed with the release of AWStats 6.4.

Updated software packages are available from:

   AWStats 6.4: http://awstats.sourceforge.net/#DOWNLOAD

VII. CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CAN-2005-1527 to this issue. This is a candidate for inclusion in
the CVE list (http://cve.mitre.org), which standardizes names for
security problems. It should be noted that this is similar to but
different from CAN-2005-0436.

VIII. DISCLOSURE TIMELINE

05/12/2005  Initial vendor notification
08/09/2005  Public disclosure

IX. CREDIT

Peter Vreugdenhil (security[at]petervreugdenhil[dot]nl) is credited with
this discovery.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp

Free tools, research and upcoming events
http://labs.idefense.com

X. LEGAL NOTICES

Copyright (c) 2005 iDEFENSE, Inc.

Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email customerservice@idefense.com for permission.

Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.
Comment 1 Harald Mueller-Ney 2005-08-10 13:24:42 UTC
=> AWStats 6.4 has replaced all eval() statements, and has mitigated the
exposure to this vulnerability.

I made a version update to 6.4 on stable before preview4 - but they say
"mitigated" not "solved".

Is it ok to stay with 6.4 or should I create a patch

     my $function="ShowInfoURL_$pluginname('$url')";
     eval("$function");

To filter $url before using it as an paramaeter for ShowInfoURL_$pluginname
Comment 2 Sebastian Krahmer 2005-08-10 13:35:03 UTC
"This vulnerability has been addressed with the release of AWStats 6.4."
So, it should be ok to stay at 6.4 no?
Comment 3 Marcus Meissner 2005-08-12 08:43:54 UTC
From: iDFEENSE Labs <labs-no-reply@idefense.com 
Subject: [Full-disclosure] Re: iDEFENSE Security Advisory 08.09.05: AWStats 
Errors-To: full-disclosure-bounces@lists.grok.org.uk 
 
Martin, 
 
Apologies for the confusion, and thank you for bringing this to our 
attention. The version information was slightly off in our original 
advisory. The vulnerability does affect AWStats 6.4 and prior, and the flaw 
has been addressed in AWStats 6.5. 
 
The patch was introduced inadvertantly when all eval() calls were replaced 
with sane function calls in the cvs commit shown here: 
 
http://cvs.sourceforge.net/viewcvs.py/awstats/awstats/wwwroot/cgi-bin/awstat 
s.pl?r1=1.819&r2=1.820&diff_format=u 
 
The patched function in AWStats 6.5 is at lines 4925 - 4936 of the 
awstats.pl script: 
 
sub ShowURLInfo { 
        my $url=shift; 
        my $nompage=CleanFromCSSA($url); 
 
        # Call to plugins' function ShowInfoURL 
        foreach my $pluginname (keys %{$PluginsLoaded{'ShowInfoURL'}})  { 
#               my $function="ShowInfoURL_$pluginname('$url')"; 
#               eval("$function"); 
                my $function="ShowInfoURL_$pluginname"; 
                &$function($url); 
        } 
 
The public advisory on our website has been updated and can be accessed at 
the following url: 
http://www.idefense.com/application/poi/display?id=290&type=vulnerabilities& 
flashstatus=true 
 
 
iDEFENSE Labs 
 
Comment 4 Sebastian Krahmer 2005-08-15 09:04:42 UTC
SM-2037
Comment 5 Sebastian Krahmer 2005-08-15 09:16:12 UTC
patchinfo submitted. Go ahead.
Comment 6 Sebastian Krahmer 2005-08-15 09:16:58 UTC
Created attachment 46024 [details]
patchinfo

...
Comment 7 Sebastian Krahmer 2005-08-15 13:04:14 UTC
Package approved. Will be annoucned with the next advisory.
Comment 8 Harald Mueller-Ney 2005-08-18 09:36:25 UTC
my work is done
Comment 9 Sebastian Krahmer 2005-08-19 08:37:12 UTC
I know :-)
Comment 10 Thomas Biege 2009-10-13 21:45:04 UTC
CVE-2005-1527: CVSS v2 Base Score: 5.0 (AV:N/AC:L/Au:N/C:N/I:P/A:N)