TP5防getshell攻擊

TP5防getshell攻擊

攻擊案例

http://你的域名/index.php?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id

以上的連接可以攻擊TP5的部分網站,出現phpinfo(),所以很多的文件位置就會暴露出來

解決方案

在這裏插入圖片描述

  • /thinkphp/library/think/App.php文件中module方法獲取去控制器的代碼下面加入以下代碼:
//防getshell入侵
        if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) {
            throw new HttpException(404, 'controller not exists:' . $controller);
        }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章