织梦DedeCMS投票漏洞修复案例

织梦/dedecms系统我们都知道是有很多漏洞的,我在调试投票功能的时候正好要用到投票功能,这不就出现了漏洞,下面我就给大家展示如何修复这个织梦投票漏洞

首先我们打开//dedevote.class.php文件,查 找代码

代码如下

t h i s > d s q l > E x e c u t e N o n e Q u e r y ( " U P D A T E d e d e v o t e S E T t o t a l c o u n t = " . ( this->dsql->ExecuteNoneQuery("UPDATE `dede_vote` SET totalcount='".( this->VoteInfos[‘totalcount’]+1)."’,
votenote=’".addslashes( i t e m s ) . " W H E R E a i d = " . items)."' WHERE aid='". this->VoteID."’");

把源代码修改为

t h i s > d s q l > E x e c u t e N o n e Q u e r y ( " U P D A T E d e d e v o t e S E T t o t a l c o u n t = " . ( this->dsql->ExecuteNoneQuery("UPDATE `dede_vote` SET totalcount='".( this->VoteInfos[‘totalcount’]+1)."’,
votenote=’".mysql_real_escape_string( i t e m s ) . " W H E R E a i d = " . m y s q l r e a l e s c a p e s t r i n g ( items)."' WHERE aid='".mysql_real_escape_string( this->VoteID)."’");
  注:

* addslashes() 是强行加;

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

最好直接使用addslashes同时要查看你php是否默认打开了addslashes这个自动功能哦,如果有了我们就不用加了,

下面我们再测试下就修复了这个漏洞,看懂了的小伙伴快去试试吧!

猜你喜欢

转载自blog.csdn.net/lifeloveme/article/details/90062706