标题:dedecms SESSION变量覆盖导致SQL注入
描述:dedecms的/plus/advancedsearch.php中,直接从$_SESSION[$sqlhash]获取值作为$query带入SQL查询,这个漏洞的利用前提是session.auto_start = 1即开始了自动SESSION会话,云盾团队在dedemcs的变量注册入口进行了通用统一防御,禁止SESSION变量的传入。
文件:/include/common.inc.php
解决方案:
大约在100行
补丁前:
foreach(Array('_GET','_POST','_COOKIE') as $_request) { foreach($$_request as $_k => $_v) { if($_k == 'nvarname') ${$_k} = $_v; else ${$_k} = _RunMagicQuotes($_v); } }
修改为:
foreach(Array('_GET','_POST','_COOKIE') as $_request) { foreach($$_request as $_k => $_v) { if( strlen($_k)>0 && eregi('^(cfg_|GLOBALS)',$_k) ){ exit('Request var not allow!'); } ${$_k} = _RunMagicQuotes($_v); } }
评论回复