During a security assessment, Ive found that my target was using Cryptographp which is a PHP script used for generate captchas.
It was easily noticeable when Ive found the following URL:
http://WWWW/cryptographp.inc.php?cfg=XX&sn=YYYY&ZZZZ
So I've decided to take a look at the source code and Ive found 2 vulnerabilities.
The first one has already been disclosed but hasnt been corrected. This vulnerability allows an attacker to execute arbitrary scripts on the host server by causing cryptographp.inc.php to include any arbitrary file existent in the same directory.
Here is the vulnerable source code:
if (is_file($_GET['cfg']) and dirname($_GET['cfg'])=='.' )
$_SESSION['configfile']=$_GET['cfg'];
else
$_SESSION['configfile']="cryptographp.cfg.php";
include($_SESSION['configfile']);
The second vulnerability can be easily found but seems not to be revealed on Internet or on an exploit database. It is an HTTP Response Splitting which can be used to perform cross-site scripting attacks, cross-user defacement, web cache poisoning, and similar exploits.
Here is the vulnerable source code:
<?php
Header("Location: cryptographp.inc.php?cfg=".$_GET['cfg']."&sn=".session_name()."&".SID);
?>
For the mitigation of this two vulnerabilities, one simple rule:
Input Validation
Lu33Y -