Home  >  Article  >  php教程  >  DedeCMS投票模块漏洞解决方法

DedeCMS投票模块漏洞解决方法

WBOY
WBOYOriginal
2016-06-21 08:49:581043browse

 

DedeCMS投票模块有朋友反映投票主题的选项经常被sql注入删除,经过iOS100知识库查看代码发现投票模块代码没有对sql参数进行转换,导致不法分子sql注入。只要讲addslashes()改为mysql_real_escape_string()即可。

打开/include/dedevote.class.php文件,查 找$this->dsql->ExecuteNoneQuery("UPDATE `#@__vote` SET totalcount='".($this->VoteInfos['totalcount']+1)."',votenote='".addslashes($items)."' WHERE aid='".$this->VoteID."'");

修改为

$this->dsql->ExecuteNoneQuery("UPDATE `#@__vote` SET totalcount='".($this->VoteInfos['totalcount']+1)."',votenote='".mysql_real_escape_string($items)."' WHERE aid='".mysql_real_escape_string($this->VoteID)."'");

注:

* addslashes() 是强行加\;

* mysql_real_escape_string()  会判断字符集,但是对PHP版本有要求;(PHP 4 >= 4.0.3, PHP 5)

* mysql_escape_string不考虑连接的当前字符集。(PHP 4 >= 4.0.3, PHP 5, 注意:在PHP5.3中已经弃用这种方法,不推荐使用)

转载请注明出处:http://www.ios100.net/open/dedecms/15830.html



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn