ecshop文章xss跨站脚本攻击漏洞修复方法
日期:2018-06-24
ECSHOP的文章、留言等页面,其实都存在XSS跨站脚本攻击漏洞,以下提供文章页面修复解决方法:
打开/includes/lib_article.php文件,最底部 ?> 的上面加入以下代码
打开/includes/lib_article.php文件,最底部 ?> 的上面加入以下代码
/* 代码过滤器 ecshop.cx */ function strFilter($str) { $str = preg_replace('/<\!--.*?-->/si', '', $str); $str = preg_replace('/<(\!.*?)>/si', '', $str); $str = preg_replace('/<(\/?html.*?)>/si', '', $str); $str = preg_replace('/<(\/?head.*?)>/si', '', $str); $str = preg_replace('/<(\/?meta.*?)>/si', '', $str); $str = preg_replace('/<(\/?body.*?)>/si', '', $str); $str = preg_replace('/<(\/?link.*?)>/si', '', $str); $str = preg_replace('/<(\/?form.*?)>/si', '', $str); $str = preg_replace('/cookie/si', '', $str); $str = preg_replace("/'/si", "", $str); $str = str_replace('/\/s', "", $str); $str = str_replace('select', '', $str); $str = str_replace('create', '', $str); $str = str_replace('delete', '', $str); $str = str_replace('insert', '', $str); $str = str_replace('<', '', $str); $str = str_replace('>', '', $str); $str = str_replace('~', '', $str); $str = str_replace('!', '', $str); $str = str_replace('!', '', $str); $str = str_replace('@', '', $str); $str = str_replace('#', '', $str); $str = str_replace('$', '', $str); $str = str_replace('¥', '', $str); $str = str_replace('%', '', $str); $str = str_replace('^', '', $str); $str = str_replace('……', '', $str); $str = str_replace('*', '', $str); $str = str_replace('(', '', $str); $str = str_replace(')', '', $str); $str = str_replace('(', '', $str); $str = str_replace(')', '', $str); $str = str_replace('——', '', $str); $str = str_replace('+', '', $str); $str = str_replace('|', '', $str); $str = str_replace('"', '', $str); $str = str_replace('“', '', $str); $str = str_replace('”', '', $str); $str = str_replace(',', '', $str); $str = str_replace(',', '', $str); $str = str_replace('', '', $str); $str = str_replace('《', '', $str); $str = str_replace('》', '', $str); $str = str_replace('。', '', $str); $str = str_replace('、', '', $str); $str = str_replace('?', '', $str); $str = str_replace(';', '', $str); return trim($str); }在打开article_cat.php文件,搜索如下代码
/* 获得文章列表 */
if (isset($_REQUEST['keywords']))
{
$keywords = addslashes(htmlspecialchars(urldecode(trim($_REQUEST['keywords']))));
$pager['search']['keywords'] = $keywords;
$search_url = substr(strrchr($_POST['cur_url'], '/'), 1);
修改成如下代码
/* 获得文章列表 ecshop.cx */
if (isset($_REQUEST['keywords']))
{
$keywords = addslashes(htmlspecialchars(urldecode(trim($_REQUEST['keywords']))));
$keywords = strFilter($keywords);
$pager['search']['keywords'] = $keywords; //Add ecshop.cx
$search_url = substr(strrchr($_POST['cur_url'], '/'), 1);
$search_url = strFilter($search_url); //Add ecshop.cx本文原创地址:https://ecshopok.com/article-384.html
版权所有 © 转载时必须以链接形式注明出处!
觉得本文对您有用,想收藏下来!方法很简单:请点击-〉
我们一直坚持白天工作、晚上熬夜更新资源,付出了巨大的精力和时间,其中的辛酸难以言述。
下一篇:Ecshop 3.0的flow.php文件SQL注射漏洞修复 上一篇:ecshop的article_cat.php文件xss跨站脚本攻击漏洞 ECSHOP SQL注入漏洞



暂无评论,来发表一个吧