博客列表 >阿里云提示ecshop中sql注入漏洞的修复

阿里云提示ecshop中sql注入漏洞的修复

Tsui的博客
Tsui的博客原创
2017年09月14日 10:08:30629浏览

修复方法如下:


1. /admin/shopinfo.php


大概在第53、71、105、123行,4个地方修复方式都一样


admin_priv('shopinfo_manage');

修改为


admin_priv('shopinfo_manage');

$_REQUEST['id'] = intval($_REQUEST['id']);





2. /admin/shophelp.php


 大概在第81、105、133、155行,4个地方修复方式都一样


admin_priv('shophelp_manage');

修改为


admin_priv('shophelp_manage');

$_POST['id'] = intval($_POST['id']);


3. /api/client/includes/lib_api.php


大概在第246行,API_UserLogin()函数中



/* SQL注入过滤 */

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'])) : '';



4. /admin/edit_languages.php


 大概在第120行


$dst_items[$i] = $_POST['item_id'][$i] .' = '. '"' .$_POST['item_content'][$i]. '";';

修改为


$dst_items[$i] = $_POST['item_id'][$i] .' = '. '\'' .$_POST['item_content'][$i]. '\';';



5. /admin/affiliate_ck.php


方法一

31和51行


由$logdb = get_affiliate_ck();改为

$_GET[auid] = intval($_GET[auid]); $logdb = get_affiliate_ck();


方法二

 大概在第291行,get_affiliate_ck()函数中


$sqladd = ' AND a.user_id=' . $_GET['auid'];

修改为


$sqladd = ' AND a.user_id=' . intval($_GET['auid']);



6. /admin/comment_manage.php


 大概在第336行,get_comment_list()函数中


$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim($_REQUEST['sort_by']);

$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);

修改为


$sort = array('comment_id','comment_rank','add_time','id_value','status');

$filter['sort_by'] = in_array($_REQUEST['sort_by'], $sort) ? trim($_REQUEST['sort_by']) : 'add_time'; 

$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : 'ASC';



7. /includes/modules/payment/alipay.php 和 /app/includes/modules/payment/alipay.php


 大概在第183行,respond()函数中


$order_sn = trim($order_sn);

修改为


$order_sn = trim(addslashes($order_sn));



8. /includes/lib_insert.php


对以下变量进行过滤


$arr['id'] = intval($arr['id']);

$arr['num'] = intval($arr['num']);

$arr['type'] = addslashes($arr['type']);



9. /admin/integrate.php


大概在第109行


$code = empty($_GET['code']) ? '' : trim($_GET['code']);

修改为


$code = empty($_GET['code']) ? '' : trim(addslashes($_GET['code']));



10./install/index.php

修复处有1处。


搜索如下代码(397行):


$result = deal_aftermath();



直接替换如下代码:


if (file_exists(ROOT_PATH . 'data/install.lock')) { $step = 'error'; $err->add($_LANG['has_locked_installer']); $err_msg = implode(',', $err->get_all()); $smarty->assign('err_msg', $err_msg); $smarty->display('error.php'); break; } 

$result = deal_aftermath();


上一条:Emmet语法下一条:在学php哇,嗯
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议