网络技术

网络技术知识分享,记录在学习工作中遇到的网络及硬件方面问题和解决方法。

dedecms安全漏洞之/include/common.inc.php漏洞解决办法

Submitted by phifans on Tue, 12/20/2022 - 10:26

 在 /include/common.inc.php  中
找到注册变量的代码

foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
         foreach($$_request as $_k => $_v) ${$_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);
    }
}