|
|
| |
| Snif is "a simple and nice index file". A vulnerability in the product allows remote attackers to download files that reside outside the bound HTML root directory. |
| |
Credit:
The information has been provided by J.
|
| |
Vulnerable systems:
* Snif versions prior to 1.2.5
Immune systems:
* Snif version 1.2.5
The script takes two query-strings "path" and "download" from the URL and concatenates them. It stores the result in the variable $filename which is the file to be downloaded. By default the value for the path variable is set to NULL and there is no error checking to see if the "download" querystring is outside the default directory. Thus an attacker could change the "download" querystring to any file on the file system while leaving the "path" NULL. This would allow him/her to download the file requested.
Vulnerable code:
// this handles the download requests
if ($_GET["download"]!="") {
// This is were the path checking fails
$filename = $path.$_GET["download"];
if (
!file_exists($filename)
OR fileIsHidden($_GET["download"])
OR (substr(strtolower($_GET["download"]), -4)==".php" AND !$allowPHPDownloads)) {
Header("HTTP/1.0 404 Not Found");
echo "<b>Error: File not found.</b><br><br>we suggest you
<a href=\"".$_SERVER["HTTP_REFERER"]."\">go back</a>";
} else {
Header("Content-Length: ".filesize($filename));
Header("Content-Type: application/x-download");
Header("Content-Disposition: attachment; filename=".$_GET["download"]);
readfile($filename);
}
die();
}
Exploit:
By requesting the following URL http://www.yourserver.com/snif/index.php?download=/etc/passwd, it is possible to download the /etc/passwd file.
Solution:
Download version 1.2.5 from the vendors homepage http://www.bitfolge.de/snif.
Vendor timeline:
24 November 2003 - Bug Found
25 November 2003 - Vendor Contacted
26 November 2003 - Vendor Fixed Bug
|
|
|