PHP — IT技术

2013 年 9 月 20 日4150

受影响系统:
PHP-NukePHP-Nuke7.8
PHP-NukePHP-Nuke7.7
PHP-NukePHP-Nuke7.6
PHP-NukePHP-Nuke7.5
不受影响系统:
PHP-NukePHP-Nuke7.9
描述:
BUGTRAQID:16732
PHP-Nuke是一个广为流行的网站创建和管理工具,它可以使用很多数据库软件作为后端,比如MySQL、PostgreSQL、mSQL、Interbase、Sybase等。
PHP-Nuke较新版本的软件包中的search模块实现上存在输入验证漏洞,远程攻击者可能利用此漏洞对服务器程序执行SQL注入攻击。
在较早版本PHP-Nuke的“modules/Search/index.php”代码中,以7.1版本为例:
----------------[sourcecode]------------------
$query=addslashes($query);
if($type=="stories"OR!$type){
if($category>0){
$categ="ANDcatid=$category";
}elseif($category==0){
$categ="";
}
$q="cts.sid,s.aid,s.informant,s.title,s.time,s.hometext,
s.bodytext,a.url,s.comments,s.topic".$prefix."_storiess,\
".$prefix."_authorsas.aid=a.aid$queryalang$categ";
if(is($query))$q.="AND(s.titleLIKE′%$query%′ORs.hometextLIKE
′%$query%′ORs.bodytextLIKE′%$query%′ORs.notesLIKE′%$query%′)";
if($author!="")$q.="ANDs.aid=′$author′";
----------------[/sourcecode]-----------------
可见addslashes()用于$query变量,因此不可能执行sql注入。而在较新PHP-Nuke版本的相同代码段中,以7.5版为例:
----------------[sourcecode]------------------
$query=stripslashes(check_html($query,"nohtml"));
if($type=="stories"OR!$type){
if($category>0){
$categ="ANDcatid=′$category′";
}else{
$categ="";
}
$q="cts.sid,s.aid,s.informant,s.title,s.time,s.hometext,
s.bodytext,a.url,s.comments,s.topic".$prefix."_storiess,\
".$prefix."_authorsas.aid=a.aid$queryalang$categ";
if(is($query))$q.="AND(s.titleLIKE′%$query%′ORs.hometextLIKE
′%$query%′ORs.bodytextLIKE′%$query%′ORs.notesLIKE′%$query%′)";
if($author!="")$q.="ANDs.aid=′$author′";
----------------[/sourcecode]-----------------
只有第一行发生了变化:
$query=stripslashes(check_html($query,"nohtml"));
在这段代码中没有正确的过滤用户输入,允许攻击者执行SQL注入攻击。
<*来源:JanekVind(come2waraxe@yahoo.com)
链接:http://http://www.zjjv.com///?l=bugtraq&m=114045901025009&w=2
*>
测试方法:
警告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
p0hh0nsee%′)UNIONALLCT1,2,aid,pwd,5,6,7,8,9,10nuke_authors/*
建议:
厂商补丁:
PHP-Nuke
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
*PHP-NukePHP-Nuke7.9.0
http://http://www.zjjv.com///modules.php?name=Release

字体[ 进入论坛] [ 推荐给朋友]

0 0