DedeCMS投票模块漏洞解决方法
2013-12-12 15:35
399 查看
DedeCMS投票模块有朋友反映投票主题的选项经常被sql注入删除,经过iOS100知识库查看代码发现投票模块代码没有对sql参数进行转换,导致不法分子sql注入。只要将addslashes()改为mysql_real_escape_string()即可。
打开/include/dedevote.class.php文件,查 找$this->dsql->ExecuteNoneQuery("UPDATE `dede_vote` SET totalcount='".($this->VoteInfos['totalcount']+1)."',votenote='".addslashes($items)."' WHERE aid='".$this->VoteID."'");
修改为
$this->dsql->ExecuteNoneQuery("UPDATE `dede_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中已经弃用这种方法,不推荐使用)
打开/include/dedevote.class.php文件,查 找$this->dsql->ExecuteNoneQuery("UPDATE `dede_vote` SET totalcount='".($this->VoteInfos['totalcount']+1)."',votenote='".addslashes($items)."' WHERE aid='".$this->VoteID."'");
修改为
$this->dsql->ExecuteNoneQuery("UPDATE `dede_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中已经弃用这种方法,不推荐使用)
相关文章推荐
- 浅析DedeCMS投票模块漏洞的解决方法
- 修改织梦DedeCMS广告模块后,前台显示未更新的解决方法
- dedecms的wap模块文章无法显示的解决方法
- DEDECMS 打开后台 模块管理总是很慢的解决方法!
- dedecms cookies泄漏导致SQL漏洞 article_add.php 的解决方法
- 修改织梦DedeCMS广告模块后,前台显示未更新的解决方法
- DEDECMS系统后台会员功能漏洞解决方法
- dedecms针对DDOS挂马漏洞的解决方法
- dedecms问答模块匿名提问的解决方法
- dedecms5.7 ask模块现404的解决方法
- 360提示DedeCms全局变量覆盖漏洞(临时解决方法)
- dedecms 5.7 最新 mytag_js.php的漏洞解决方法
- struts2危险漏洞解决方法
- dedeCMS生成RSS文件时出现两次域名的解决方法
- 二 关于s5p4418 无线wifi模块出现SDIO读写错误的解决方法
- dedecms后台验证码总提示错误的解决方法
- mavn打包子模块时,没有把xml资源文件打包到jar文件的解决方法。
- PHP 5.6.11中CURL模块问题的解决方法
- 工作流中的流程和业务功能图中自己新增的模块没有出现的解决方法
- xss漏洞,添加xssFilter后,乱码,解决方法