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

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

缺陷编号:wooyun-2014-067383

漏洞标题:phpdisk代码设计缺陷导致SQL注入一枚

相关厂商:phpdisk.com

漏洞作者: 飞扬风

提交时间:2014-07-09 16:02

修复时间:2014-10-04 16:04

公开时间:2014-10-04 16:04

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:15

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-07-09: 细节已通知厂商并且等待厂商处理中
2014-07-14: 厂商主动忽略漏洞,细节向第三方安全合作伙伴开放
2014-09-07: 细节向核心白帽子及相关领域专家公开
2014-09-17: 细节向普通白帽子公开
2014-09-27: 细节向实习白帽子公开
2014-10-04: 细节向公众公开

简要描述:

攒wb~

详细说明:

漏洞存在版本为PHPDisk F-Core系列
测试版本为PHPDisk F-Core v1.1 20140703
SQL注入在发布资源时被触发,参数post_tag为注入点,上代码
/modules/post.inc.php,第124行左右

$db->query_unbuffered("insert into {$tpf}posts set ".$db->sql_array($ins)."");
$pid = $db->insert_id();
make_tags($tags,$tag_arr,$pid); //注入点
$db->query_unbuffered("update {$tpf}categories set cate_num=cate_num+1 where cate_id='$cate_id'");
$sysmsg[] = $settings[pd_post_name].'发布成功';


跟进make_tags函数看一下

function make_tags($tags,$tag_arr,$file_id){
global $db,$tpf,$timestamp,$pd_uid;
if($tags){
$tags = filter_tag($tags);
$tags_str = '';
for($i=0;$i<count($tag_arr);$i++){
if($tag_arr[$i]){
$tags_str .= "'".filter_tag($tag_arr[$i])."',";//filter_tag对tag的值做了处理
$rs = $db->fetch_one_array("select count(*) as total from {$tpf}post2tag where tag_name='{$tag_arr[$i]}' and pid='{$file_id}'");
if(!$rs['total']){
$ins = array(
'tag_name' => $tag_arr[$i],
'pid' => $file_id,
);
$db->query_unbuffered("insert into {$tpf}post2tag set ".$db->sql_array($ins).";");
}
unset($rs);
}
}
$tags_str = (substr($tags_str,-1) ==',') ? substr($tags_str,0,-1) : $tags_str;
$db->query_unbuffered("update {$tpf}tags set tag_count=tag_count-1 where tag_name in (select tag_name from {$tpf}post2tag where pid='$file_id')");
//echo "delete from {$tpf}post2tag where pid='$file_id' and tag_name not in ($tags_str)";
$db->query_unbuffered("delete from {$tpf}post2tag where pid='$file_id' and tag_name not in ($tags_str)"//留下反斜杠注入发生


filter_tag函数是重点,跟进这个函数看下

function filter_tag($str){
return str_replace(array('"',"'",'/','(',')','*'),'',$str);
}


这个函数对单引号等特殊字符进行过滤,过滤为空~,但是由POST传入的数据是经过addslashes过滤的,在这里再把单引号拿掉的话,就会把反斜杠给剩下,导致注入的发生

漏洞证明:

本地搭建环境来测试一下

QQ截图20140704143809.jpg


官方测试站点也测一下
http://demo.phpdisk.com/f/

QQ截图20140704144100.jpg


QQ截图20140704144116.jpg


没有mysql报错,盲注或者延时都可以

修复方案:

有addslashes的情况下,可以不需要filter_tag了

版权声明:转载请注明来源 飞扬风@乌云


漏洞回应

厂商回应:

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

忽略时间:2014-10-04 16:04

厂商回复:

最新状态:

暂无