5.0版本
在think\App类的module方法的获取控制器的代码后面加上

代码片段
3 行
if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
    throw new HttpException(404, 'controller not exists:' . $controller);
}

5.1版本
在think\route\dispatch\Url类的parseUrl方法,解析控制器后加上

代码片段
3 行
if ($controller && !preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
    throw new HttpException(404, 'controller not exists:' . $controller);
}
article image

ThinkPHP官方博客

GDScript3
3 行
一句话代码:
http://www.xxxx.com/?s=index/\think\App/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
如果修复成功,那这段代码将不会执行,thinkphp5就会有错误提示

存在漏洞,出现phpinfo的页面

article image

错误提示

article image

ThinkPHP 5.1.x SQL注入漏洞
改进order方法解析

article image

Thinkphp5开启强制路由

文件:application->config.php

article image