文章来源:http://www.imtr.cn/html/n162.html
漏洞名称:dedecms SESSION变量覆盖导致SQL注入
危险等级:★★★★★(高危)
漏洞文件:/include/common.inc.php
披露时间:2016-07-14
官方修复:官方网站的 V5.7SP2正式版 (2018-01-09)已经修复该漏洞
漏洞描述:dedecms的/plus/advancedsearch.php中,直接从$_SESSION[$sqlhash]获取值作为$query带入SQL查询,这个漏洞的利用前提是session.auto_start = 1,即开始了自动SESSION会话。
修复方法:
打开/include/common.inc.php
找到大概第68行的代码:
if( strlen($svar)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE)#',$svar) )
修改为:
if( strlen($svar)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#',$svar) )
再找到大概第90行的代码:
if( strlen($val)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE)#',$val) )
修改为:
if( strlen($val)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#',$val) )
这样就在织梦的变量注册入口进行了通用统一防御,禁止SESSION变量的传入。
原文地址:http://www.imtr.cn/html/n162.html