影响版本:
ECSHOP 2.7.2 Release 0604
程序介绍:
ECSHOP是一款开源免费的网上商店系统。由专业的开发团队升级维护,为您提供及时高效的技术支持,您还可以根据自己的商务特征对ECSHOP进行定制,增加自己商城的特色功能。
漏洞分析:
在include_libcommon.php中存在如下函数
functionget_package_info($id)
{
global$ecs,$db,$_CFG;
$now=gmtime();
$sql=SELECTact_idASid,act_nameASpackage_name,goods_id,goods_name,start_time,end_time,act_desc,ext_info.
FROM.$GLOBALS['ecs']->table('goods_activity').
WHEREact_id='$id'ANDact_type=.GAT_PACKAGE;
$package=$db->GetRow($sql);
/*将时间转成可阅读格式*/
if($package['start_time']<=$now&&$package['end_time']>=$now)
{
$package['is_on_sale']=1;
}
else
{
$package['is_on_sale']=0;
}
$package['start_time']=local_date('Y-m-dH:i',$package['start_time']);
$package['end_time']=local_date('Y-m-dH:i',$package['end_time']);
$row=unserialize($package['ext_info']);
unset($package['ext_info']);
if($row)
{
foreach($rowas$key=>$val)
{
$package[$key]=$val;
}
}
$sql=SELECTpg.package_id,pg.goods_id,pg.goods_number,pg.admin_id,.
g.goods_sn,g.goods_name,g.market_price,g.goods_thumb,g.is_real,.
IFNULL(mp.user_price,g.shop_price*'$_SESSION[discount]')ASrank_price.
FROM.$GLOBALS['ecs']->table('package_goods').ASpg.
LEFTJOIN.$GLOBALS['ecs']->table('goods').ASg.
ONg.goods_id=pg.goods_id.
LEFTJOIN.$GLOBALS['ecs']->table('member_price').ASmp.
ONmp.goods_id=g.goods_idANDmp.user_rank='$_SESSION[user_rank]'.
WHEREpg.package_id=.$id..
ORDERBYpg.package_id,pg.goods_id;
$goods_res=$GLOBALS['db']->getAll($sql);
$market_price=0;
其中$id没有经过严格过滤就直接进入了SQL查询,导致一个SQL注射漏洞。
在系统的lib_order.php中存在一个该函数的调用
functionadd_package_to_cart($package_id,$num=1)
{
$GLOBALS['err']->clean();
/*取得礼包信息*/
$package=get_package_info($package_id);
if(emptyempty($package))
{
$GLOBALS['err']->add($GLOBALS['_LANG']['goods_not_exists'],ERR_NOT_EXISTS);
returnfalse;