刚解决了一个ThinkPHP <5.0.24 Request.php 远程代码执行漏洞,又来一个ThinkPHP 5 <=5.0.22 远程代码执行高危漏洞咋办?看下面的解决方法!
1. 打开你的网站,进入根目录。根据这个路径找到thinkphp\library\think\App.php文件。
2. 我的在553行每个人可能不一样,具体你可以搜索下
$controller = strip_tags($result[1] ?: $config['default_controller']);
3. 然后在这一行后面插入:
if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)){ throw new HttpException(404, 'controller not exists:' . $controller); }
4. 如下图:
OK,这样就完成漏洞修复了,试试再去检测一次吧。修改前记得备份噢!
如果内容有帮助,就点个赞吧!