行动那才是最重要的,而每个行动都有其代价和欢乐之处,人生的旅行过程给我快乐,而不是那目的地。
影响版本: ECSHOP 2.7.2 Release 0604
程序介绍:
ECSHOP是一款开源免费的网上商店系统。由专业的开发团队升级维护,为您提供及时高效的技术支持,您还可以根据自己的商务特征对ECSHOP进行定制,增加自己商城的特色功能。
漏洞分析:
在include_libcommon.php中存在如下函数
PHP Code复制内容到剪贴板
- function get_package_info($id)
- {
- global $ecs, $db,$_CFG;
- $now = gmtime();
- $sql = "SELECT act_id AS id, act_name AS package_name, goods_id , goods_name, start_time, end_time, act_desc, ext_info".
- " FROM " . $GLOBALS['ecs']->table('goods_activity') .
- " WHERE act_id='$id' AND act_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-d H:i', $package['start_time']);
- $package['end_time'] = local_date('Y-m-d H:i', $package['end_time']);
- $row = unserialize($package['ext_info']);
- unset($package['ext_info']);
- if ($row)
- {
- foreach ($row as $key=>$val)
- {
- $package[$key] = $val;
- }
- }
- $sql = "SELECT pg.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]') AS rank_price " .
- " FROM " . $GLOBALS['ecs']->table('package_goods') . " AS pg ".
- " LEFT JOIN ". $GLOBALS['ecs']->table('goods') . " AS g ".
- " ON g.goods_id = pg.goods_id ".
- " LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
- "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
- " WHERE pg.package_id = " . $id. " ".
- " ORDER BY pg.package_id, pg.goods_id";
- $goods_res = $GLOBALS['db']->getAll($sql);
- $market_price = 0;
其中$id没有经过严格过滤就直接进入了SQL查询,导致一个SQL注射漏洞。
在系统的lib_order.php中存在一个该函数的调用
PHP Code复制内容到剪贴板
- function add_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);
- return false;
- }
PHP Code复制内容到剪贴板
- $package = $json->decode($_POST['package_info']);
- /* 如果是一步购物,先清空购物车 */
- if ($_CFG['one_step_buy'] == '1')
- {
- clear_cart();
- }
- /* 商品数量是否合法 */
- if (!is_numeric($package->number) || intval($package->number) <= 0)
- {
- $result['error'] = 1;
- $result['message'] = $_LANG['invalid_number'];
- }
- else
- {
- /* 添加到购物车 */
- if (add_package_to_cart($package->package_id, $package->number))
- {
- if ($_CFG['cart_confirm'] > 2)
$package->package_id来源于输入
解决方案:
厂商补丁
ECSHOP
----------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:
http://www.ecshop.com
信息来源:
来源: WooYun
本文ECSHOP php商城系统过滤不严导致SQL注入漏洞到此结束。往事如歌,在人生的旅途中,尽管有过坎坷,有过遗憾,却没有失去青春的美丽。相信自己,希望总是有的,让我们记住那句话:错过了太阳,我不哭泣,否则,我将错过月亮和星辰。小编再次感谢大家对我们的支持!