CGI.pm Library Input Validation Flaw Permits Remote Cross-Site Scripting Attacks
SecurityTracker Alert ID: 1007234|
SecurityTracker URL: http://securitytracker.com/id/1007234
(Links to External Site)
Updated: Mar 10 2006|
Original Entry Date: Jul 21 2003
Disclosure of authentication information, Disclosure of user information, Execution of arbitrary code via network, Modification of user information|
Vendor Confirmed: Yes Exploit Included: Yes |
An input validation vulnerability was reported in the 'CGI.pm' library. A remote user can conduct cross-site scripting attacks against an application based on the library, depending on how the library is used.|
Scripts that use the start_form() function may be affected by this flaw. The function reportedly does not properly filter user-supplied input when creating web forms. A remote user can create a specially crafted URL that, when loaded by a target user, will cause arbitrary scripting code to be executed by the target user's browser. The code will originate from the site running the vulnerable software and will run in the security context of that site. As a result, the code will be able to access the target user's cookies (including authentication cookies), if any, associated with the site, access data recently submitted by the target user via web form to the site, or take actions on the site acting as the target user.
A demonstration exploit URL is provided:
Whether or not an application that uses the library is affected or not depends on how the library is used.
The vendor was reportedly notified on April 30, 2003.
Eye on Security reported this vulnerability.
A remote user can access the target user's cookies (including authentication cookies), if any, associated with the site running an application based on the library, access data recently submitted by the target user via web form to the site, or take actions on the site acting as the target user.|
No solution was available at the time of this entry. The vendor reportedly plans to issue a fix.|
Vendor URL: stein.cshl.org/WWW/software/CGI/ (Links to External Site)
Input validation error|
|Underlying OS: Linux (Any), UNIX (Any), Windows (Any)|
This archive entry has one or more follow-up message(s) listed below.|
Source Message Contents
Subject: [Full-Disclosure] CGI.pm vulnerable to Cross-site Scripting.|
Advisory Title: CGI.pm vulnerable to Cross-site Scripting.
Release Date: July 19 2003
Application: CGI.pm - which is by default included in many common Perl
Platform: Most platforms. Tested on Apache and IIS.
Severity: Effects scripts which make use of start_form()
[ firstname.lastname@example.org ]
first informed on 30th April 2003
Although the author told EoS that he will be releasing a fix within a
week from his last correspondence (May15), no fix is out yet on his
This perl 5 library uses objects to create Web fill-out forms on the fly
and to parse their contents. It provides a simple interface for parsing
and interpreting query strings passed to CGI scripts. However, it also
offers a rich set of functions for creating fill-out forms. Instead of
remembering the syntax for HTML form elements, you just make a series of
perl function calls. An important fringe benefit of this is that the
value of the previous query is used to initialize the form, so that the
state of the form is preserved from invocation to invocation. .
CGI.pm has the ability to create forms by making use of the start_form()
function. The developer/perl scripter can also makes use of
start_multipart_form() which relies on start_form() and is therefore
vulnerable to the same issue. When the action for the form is not
specified, it is given the value of $self->url(-absolute=>1,-path=>1) -
which means that when the url is something like the following :
.. the form becomes <form action="http://host/script.pl">some text<!-- "
In such case, it is possible to exploit this issue to launch a Cross
Site Scripting attack.
# example of exploitable script
$q = new CGI;
print $q->start_html('CGI.pm XSS');
I fixed my CGI.pm by adding the following code at line 1537
$action =~ s/\"/\%22/g;
The information within this document may change without notice. Use of
this information constitutes acceptance for use in an AS IS
condition. There are NO warranties with regard to this information.
In no event shall the author be liable for any consequences whatsoever
arising out of or in connection with the use or spread of this
information. Any use of this information lays within the user's
Please send suggestions, updates, and comments to:
Eye on Security
mail : email@example.com
web : http://www.eyeonsecurity.org
Full-Disclosure - We believe in it.