Home / exploitsPDF  

BSW Gallery Shell Upload

Posted on 18 October 2012

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ Undergroundthalo Hacking Team - Security Advisory ³ ³ ³ ÚÁ----------------------------------------À³Ã™-----------------------------------Á¿ ³ ³Ãš´ Author : cr4wl3r ³ Release Date : 18-Okt-2012 ÿ³ ³³³ Product : BSW Gallery ³ Size : 38.2 kB ³³³ ³³³ Link : http://sourceforge.net/projects/bswgallery/ ³³³ ³ÃƒÃ------------------------------------------³-------------------------------------Á´Â³ ³³ gallery.zip ³ ³³ ³Ã€Ã„ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ³ ³ Details ³ ³ ³ ³ BSW Gallery ³ ³ ³ ³ This is a very simple photo gallery which is written in PHP code ³ ³ designer by Dr.Mohamed AbdelWahab ³ ³ The web application is vulnerable Arbitrary File Upload ³ ³ where an attacker could upload a malicious php code without difficulty ³ ³ on the file to be uploaded ³ ³------------------------------------------------------------------------------------³ Code in uploadpic.php print "<form method="POST" action="dopic.php"enctype="multipart/form-data" style="width: 227px">"; print "<table align="center" style="width: 600px"dir="ltr"><tr><th align="right"width="120" class="topic"><b>File Upload:</b></th>"; print "<th align="left"><input type="file" name="fileupload"></th></tr>"; print "<tr><th><input type="hidden" name="MAX_FILE_SIZE" value="10240000"></th></tr></table>"; print"<table align="center"width="600"dir="ltr">"; print"<th class="topic"width="120"align="right">Image Title</th><th align="left"><input style="width:400"type="text" name="picture" /></th></table>"; print"<table align="center"dir="ltr" width="600"><th class="topic" width="120"align="right">Image Description</th>"; print"<th align="left"><textarea name="descrip"cols="48"rows="5"></textarea></th></table>"; Code in dopic.php $fname=$_POST['picture']; $descrip=$_POST['descrip']; $file_dir ="gallery/"; foreach($_FILES as $file_name => $file_array) { echo "path: ".$file_array["tmp_name"]."<br/> "; echo "name: ".$file_array["name"]."<br/> "; echo "type: ".$file_array["type"]."<br/> "; echo "size: ".$file_array["size"]."<br/> "; if (is_uploaded_file($file_array["tmp_name"])) { move_uploaded_file($file_array["tmp_name"], "$file_dir/".$file_array["name"]) or die ("Couldn't copy"); echo "Done!<br/>"; } } $image=$file_dir.$file_array["name"]; $ip = getenv("REMOTE_ADDR"); $sql = "insert into gallery (picture,files,descrip,updated)values('$fname','$image','$descrip',now());"; mysql_query($sql,$mysql); mysql_close($mysql); ³------------------------------------------------------------------------------------³ ³ Proof of Concept : ³ ³ ³ ³ http://b0x/path_gallery/uploadpic.php ³ ³ ³ ³ Shell : ³ ³ ³ ³ http://b0x/path_gallery/gallery/shell.php ³ ³ ³ ³ See for the demo : ³ ³ ³ ³ http://0xuht.org/demo/demo1.png ³ ³ http://0xuht.org/demo/demo2.png ³ ³ http://0xuht.org/demo/demo3.png ³ ³ ³ ³ ³ ³ Undergroundthalo Hacking Team ³ ³ Site: http://0xuht.org ³ ³ Twitter: @hackb0x ³ ³ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ Happy Birhtday Saskia Adam :) ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

 

TOP