当前位置:网站首页>thinkphp 6.x arbitrary file write vulnerability
thinkphp 6.x arbitrary file write vulnerability
2022-08-07 09:24:00 【Aiwin-Lau】
Table of Contents
Foreword
Tips: Here you can add the general content to be recorded in this article:
ThinkPHP v6.0.0~6.0.1 has an arbitrary file operation vulnerability. The main reason is that the session is called to write the file, resulting in the vulnerability. The patch detects whether the incoming $sessionId is only composed of letters orComposed of numeric characters.
Tips: The following is the text of this article, and the following cases are for reference
I. Recurrence
The method of customizing a vulnerability on the back-end index/vuln page:public function vuln(Request $request, Session $session){$param = $request->get('param');$session->set('session_key', $param);return "success";}Visit the index/vuln page, pass in the value of param and modify the PHPSESSID to a 32-bit file name to be written:

Incoming a Trojan horse, try to connect with ant sword


After that, you can try to bounce the shell to directly get the control of the target drone
II. Vulnerability Analysis
The thinkphp framework first calls the handle method to initialize the session, and assigns the value of $cookieName to PHPSESSID through getname() 
The value of $cookieName is the defined PHPSESSID. Finally, enter the setId() function to assign the value of $SessionId, that is, the value of PHPSESSID.

No restrictions on $id other than 32-bit length
Finally, enter the save() function to save the session data, add the sess_ prefix, and finally call the file_put_contents() method in the wirteFile() function to write the content

$path is the content of PHPSESSID, and $content is the content of the parameter param, which leads to the writing of any file.
Reference article:ThinkPHP v6.0.0~6.0.1 Arbitrary File Operation Vulnerability Analysis | J0k3r's Blog
边栏推荐
猜你喜欢

Spark SQL深入分析之图解五种Join策略的执行流程与应用场景

Vitalik 详解 5 种不同类型的 ZK-EVM

微突发丢包的艺术

leetcode 26. 删除有序数组中的重复项(实现unique函数)

在 MIT 教了大半辈子书,他学会 10 件事

What is MES production management system? Why do we need to use ERP system?

Canvas image drawing (with zoom in, zoom out and drag functions)

Addition, deletion, search and modification of doubly linked list

#yyds干货盘点#【愚公系列】2022年08月 Go教学课程 004-Go代码注释

LeetCode【206.反转链表】(1)
随机推荐
openharmony new contribution guide
redis的原理和源码-集群的原理和源码解析(上)
SRM系统是什么?有什么作用?企业如何应用SRM系统?
canvas图像绘制(有放大缩小和拖动功能)
3. Advanced ROS communication mechanism
Vitalik 详解 5 种不同类型的 ZK-EVM
力拓信创生态,博睿数据多款产品获得东方通与达梦数据库产品兼容互认证明
选择排序(简单选择排序和堆排序)
【位带操作对寄存器赋值】基于ADuCM4050的GPIO复用模式初始化
(八)DDR_PHY架构及功能——(PUB组成、初始化及Training流程、Clock关系)
redis的原理和源码-sentinel哨兵的原理和源码解析(上)
opencv图像旋转
帕累托分析中的累计优化
the largest area of the island
Database connection pool commons-pool source code analysis
The principle and source code of redis - the principle of master-slave replication
思维和方法:冯诺依曼代码分析法:高效阅读理解和写代码
E-commerce data warehouse notes 1 (data warehouse concept, project requirements and architecture design, data generation module)
微突发丢包的艺术
ABP 6.0.0-rc.1的新特性