Cgiecho XSS and Information Disclosure
cgiecho is a test cgi script, usually packaged with a formmailer called cgiemail. It's found in the cgi-bin directory of a lot of sites, due to it being a default script in many cPanel installations. The script was written by somebody at MIT some time ago, and so is common on high-profile sites such as mit.edu and
xmission.com.
The script contains XSS and path disclosure holes, one example of which can found on mit.edu, but that's not really the emphasis of this report.
Basically, cgiemail allows a user to specify a template file from anywhere within the web root. When data is posted to it, substitutions are made based on the parameters posted and the content of the template file.
For example, if a template file "/templates/mail.txt" contains the following:
When the parameters firstname=dr&lastname=evil are submitted to http://victim.com/cgi-bin/cgiecho/templates/mail.txt, the returned page will make those substitutions.
Many web scripting languages dereference array values using the [] characters, so the cgiecho script can be forced to return the contents of sensitive files if the index of any one array is known.
If a configuration file is located at /includes/config.php and contains the following:
An attacker can post "%27DOCUMENT_ROOT%27=bork" to http://victim.com/cgi-bin/cgiecho/includes/config.php and read the contents of that file.
For testing purposes, a form to generate correct attack parameters is located here.
xmission.com.
The script contains XSS and path disclosure holes, one example of which can found on mit.edu, but that's not really the emphasis of this report.
Basically, cgiemail allows a user to specify a template file from anywhere within the web root. When data is posted to it, substitutions are made based on the parameters posted and the content of the template file.
For example, if a template file "/templates/mail.txt" contains the following:
Hello [firstname] [lastname]!When the parameters firstname=dr&lastname=evil are submitted to http://victim.com/cgi-bin/cgiecho/templates/mail.txt, the returned page will make those substitutions.
Many web scripting languages dereference array values using the [] characters, so the cgiecho script can be forced to return the contents of sensitive files if the index of any one array is known.
If a configuration file is located at /includes/config.php and contains the following:
define('HOME', $_SERVER['DOCUMENT_ROOT']);
define('USERNAME', 'victim');
define('PASSWORD', 'secret');An attacker can post "%27DOCUMENT_ROOT%27=bork" to http://victim.com/cgi-bin/cgiecho/includes/config.php and read the contents of that file.
define('HOME', $_SERVER[bork]);
define('USERNAME', 'victim');
define('PASSWORD', 'secret');For testing purposes, a form to generate correct attack parameters is located here.
Labels: 0-Day, cPanel, Exploits, Full Disclosure, XSS


0 Comments:
Post a Comment
<< Home