1.
漏洞名称:
ecshop注入漏洞
漏洞描述:
ECShop存在一个盲注漏洞,问题存在于/api/client/api.php文件中,提交特制的恶意POST请求可进行SQL注入攻击,可获得敏感信息或操作数据库。【注意:该补丁为云盾自研代码修复方案,云盾会根据您当前代码是否符合云盾自研的修复模式进行检测,如果您自行采取了底层/框架统一修复、或者使用了其他的修复方案,可能会导致您虽然已经修复了改漏洞,云盾依然报告存在漏洞,遇到该情况可选择忽略该漏洞提示】
修改:api/client/includes/lib_api.php
function API_UserLogin($post)
{
if(get_magic_quotes_gpc()){
$post['UserId']=$post['UserId'];
}else{
$post['UserId']=addslashes($post['UserId']);
}
$post['username'] = isset($post['UserId']) ? trim($post['UserId']) : '';
$post['password'] = isset($post['Password']) ? strtolower(trim($post['Password'])) : '';
/* 检查密码是否正确 */
$sql = "SELECT user_id, user_name, password, action_list, last_login".
" FROM " . $GLOBALS['ecs']->table('admin_user') .
" WHERE user_name = '" . htmlspecialchars($post['username']). "'";//对用户名进行简单过滤
$row = $GLOBALS['db']->getRow($sql);
2.跨站攻击
www.aaa.com/mobile/buy.php?id=849
在includes/init.php中引入阿里云通用漏洞补丁文件,waf.php。
require(ROOT_PATH . 'includes/waf.php');
修改:includes/lib_order.php
1251 else //购物车没有此物品,则插入
1252 {
1253 $goods_price = get_final_price($goods_id, $num, true, $spec);
1254 $parent['goods_price'] = max($goods_price, 0);
1255 $parent['goods_number'] = $num;
1256 $parent['parent_id'] = 0;
1257 $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('cart'). " WHERE goods_id = '$goods_id' ";
1258 $hasgoods = $GLOBALS['db']->query($sql);
1259 if(empty($hasgoods)){
1260 $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('cart'), $parent, 'INSERT');
1261 }else{
1262 echo "该商品已经存在!";exit;
1263 }
1264 }
1265 }
如果不修改lib_order.php文件,跨站攻击虽然阻止了,但是数据库错误语句会暴露!
3.
漏洞名称:
ecshop注入漏洞
补丁编号:
2785226
补丁文件:
/flow.php
补丁来源:
云盾自研
更新时间:
漏洞描述:
ECSHOP的配送地址页面网页没有验证地区参数的有效性,存在sql注入漏洞,攻击者可利用火狐tamper data等插件修改提交到配送地址页面的post数据,造成未授权的数据库操作甚至执行任意代码。
修改:flow.php
376 * 保存收货人信息
377 */
378 $consignee = array(
379 'address_id' => empty($_POST['address_id']) ? 0 : intval($_POST['address_id']),
380 'consignee' => empty($_POST['consignee']) ? '' : trim(htmlspecialchars($_POST['consignee'])),
381 'country' => empty($_POST['country']) ? '' : intval($_POST['country']),
382 'province' => empty($_POST['province']) ? '' : intval($_POST['province']),
383 'city' => empty($_POST['city']) ? '' : intval($_POST['city']),
384 'district' => empty($_POST['district']) ? '' : intval($_POST['district']),
385 'email' => empty($_POST['email']) ? '' : htmlspecialchars($_POST['email']),
386 'address' => empty($_POST['address']) ? '' : htmlspecialchars($_POST['address']),
387 'zipcode' => empty($_POST['zipcode']) ? '' : make_semiangle(trim(htmlspecialchars($_POST['zipcode']))),
388 'tel' => empty($_POST['tel']) ? '' : make_semiangle(trim(htmlspecialchars($_POST['tel']))),
389 'mobile' => empty($_POST['mobile']) ? '' : make_semiangle(trim(htmlspecialchars($_POST['mobile']))),
390 'sign_building' => empty($_POST['sign_building']) ? '' : htmlspecialchars($_POST['sign_building']),
391 'best_time' => empty($_POST['best_time']) ? '' : htmlspecialchars($_POST['best_time']),
392 );
使用htmlspecialchars不能消除漏洞,
$consignee = array(
'address_id' => empty($_POST['address_id']) ? 0 : intval($_POST['address_id']),
'consignee' => empty($_POST['consignee']) ? '' : compile_str(trim($_POST['consignee'])),
'country' => empty($_POST['country']) ? '' : intval($_POST['country']),
'province' => empty($_POST['province']) ? '' : intval($_POST['province']),
'city' => empty($_POST['city']) ? '' : intval($_POST['city']),
'district' => empty($_POST['district']) ? '' : intval($_POST['district']),
'email' => empty($_POST['email']) ? '' : compile_str($_POST['email']),
'address' => empty($_POST['address']) ? '' : compile_str($_POST['address']),
'zipcode' => empty($_POST['zipcode']) ? '' : compile_str(make_semiangle(trim($_POST['zipcode']))),
'tel' => empty($_POST['tel']) ? '' : compile_str(make_semiangle(trim($_POST['tel']))),
'mobile' => empty($_POST['mobile']) ? '' : compile_str(make_semiangle(trim($_POST['mobile']))),
'sign_building' => empty($_POST['sign_building']) ? '' : compile_str($_POST['sign_building']),
'best_time' => empty($_POST['best_time']) ? '' : compile_str($_POST['best_time']),
);
4.
漏洞名称:
ecshop SQL注入漏洞
补丁编号:
6850408
补丁文件:
/admin/affiliate_ck.php
补丁来源:
云盾自研
更新时间:
漏洞描述:
ecshop的后台编辑文件/admin/affiliate_ck.php中,对输入参数auid未进行正确类型转义,导致整型注入的发生。
修改:
affiliate_ck.php
39 if (!empty($_GET['auid']))
40 {
41 $smarty->assign('action_link', array('text' => $_LANG['back_note'], 'href'=>"users.php?act=edit&id=intval($_GET[auid])"));//注:该处auid需要用单引号包围
42 }
224 if (isset($_GET['auid']))
225 {
226 $sqladd = ' AND a.user_id=' . intval($_GET['auid']);
227 }
5.
漏洞名称:
ecshop SQL注入漏洞
补丁编号:
6699875
补丁文件:
/admin/shophelp.php
补丁来源:
云盾自研
更新时间:
漏洞描述:
ecshop的后台编辑文件/admin/shophelp.php中,对输入参数$_POST['id']未进行正确类型转义,导致整型注入的发生。
修改:
shophelp.php
107 /* 取得文章数据 */
108 $sql = "SELECT article_id, title, content FROM ".$ecs->table('article')."WHERE article_id =".intval($_REQUEST['id']);
109 $article = $db->GetRow($sql);
125 /* 检查重名 */
126 if ($_POST['title'] != $_POST['old_title'])
127 {
128 $is_only = $exc->is_only('title', htmlspecialchars($_POST['title']), intval($_POST['id']));
129
130 if (!$is_only)
131 {
132 sys_msg(sprintf($_LANG['title_exist'], stripslashes($_POST['title'])), 1);
133 }
134 }
135
136 /* 更新数据 */
137 $cur_time = gmtime();
138 if ($exc->edit("title='$_POST[title]', content='$_POST[FCKeditor1]',add_time ='$cur_time'",intval($_POST['id'])))
139 {
140 /* 清除缓存 */
141 clear_cache_files();
135 /* 取文章数据 */
136 $sql = "SELECT article_id,title, cat_id, article_type, is_open, author, author_email, keywords, content FROM "
.$ecs->table('article'). " WHERE article_id=intval($_REQUEST['id'])";
6.
漏洞名称:
ecshop后台SQL注入
补丁编号:
6461678
补丁文件:
/admin/comment_manage.php
补丁来源:
云盾自研
更新时间:
漏洞描述:
ecshop的/admin/comment_manage.php中,对输入参数sort_by、sort_order未进行严格过滤,导致SQL注入
修改:
comment_manage.php
336 $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim(htmlspecialchars($_REQUEST['sort_by']));
337 $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim(htmlspecialchars($_REQUEST['sort_order']));
338
7.
漏洞名称:
ecshop注入漏洞
补丁编号:
2785221
补丁文件:
/api/client/includes/lib_api.php
补丁来源:
云盾自研
更新时间:
漏洞描述:
ECShop存在一个盲注漏洞,问题存在于/api/client/api.php文件中,提交特制的恶意POST请求可进行SQL注入攻击,可获得敏感信息或操作数据库。
修改:api/client/includes/lib_api.php
241 * 用户登录函数
242 * 验证登录,设置COOKIE
243 *
244 * @param array $post
245 */
246 function API_UserLogin($post)
247 {
248 $post['username'] = isset($post['UserId']) ? trim(htmlspecialchars($post['UserId'])) : '';
8.
漏洞名称:
ecshop注入漏洞
补丁编号:
1948165
补丁文件:
/includes/modules/payment/alipay.php
补丁来源:
云盾自研
更新时间:
漏洞描述:
ECSHOP支付插件存在SQL注入漏洞,此漏洞存在于/includes/modules/payment/alipay.php文件中,该文件是ECshop的支付宝插件。由于ECShop使用了str_replace函数做字符串替换,黑客可绕过单引号限制构造SQL注入语句。只要开启支付宝支付插件就能利用该漏洞获取网站数据,且不需要注册登入。
修改:alipay.php
219 $order_sn = str_replace($_GET['subject'], '', $_GET['out_trade_no']);
220 $order_sn = trim($order_sn);
221 $len = strlen($_GET['subject']);
222 $t_subject = substr ($_GET['out_trade_no'], 0, $len);
223 //$order_sn = substr ($_GET['out_trade_no'], $len);
224 if ($t_subject != $_GET['subject'])
225 {
226 $order_sn = $_GET['out_trade_no'];
227 }
228 /**
229 * end
230 */
231 //$order_sn = trim($order_sn);