当前位置:网站首页>文件包含&条件竞争
文件包含&条件竞争
2022-06-30 19:43:00 【哇咔哇咔哇咔哇咔】
session.upload_progress
与open_basedir、allow_url_fopen、allow_url_include等PHP配置一样,session.upload_progress也是PHP的一个功能,同样可以在php.ini中设置相关属性。其中最重要的几个设置如下:
session.upload_progress.enabled = on
session.upload_progress.cleanup =on
session.upload_progress.prefix = “upload_progress_”
session.upload_progress.name = “PHP_SESSION_UPLOAD_PROGRESS”
session.upload_progress.enabled可以控制是否开启session.upload_progress功能
session.upload_progress.cleanup可以控制是否在上传之后删除文件内容
session.upload_progress.prefix可以设置上传文件内容的前缀
session.upload_progress.name的值即为session中的键值
将session.upload_progress.enabled的值设置为on时,此时我们再往服务器中上传一个文件时,PHP会把该文件的详细信息(如上传时间、上传进度等)存储在session当中。
那么这个时候就会有一个前提条件,就是如何初始化session并且把session中的内容写到文件中去呢?
可以注意到,php.ini中session.use_strict_mode选项默认是0,在这个情况下,用户可以自己定义自己的sessionid,例如当用户在cookie中设置sessionid=Lxxx时,PHP就会生成一个文件/tmp/sess_Lxxx,此时也就初始化了session,并且会将上传的文件信息写入到文件/tmp/sess_Lxxx中去
当session.upload_progress.cleanup的值为on时,即使上传文件,但是上传完成之后文件内容会被清空,这怎么办?
这个时候可以利用Python的多线程,进行条件竞争。
利用session.upload_progress进行RCE
一:
通过session_start()才能开启session,那如果没有session_start()这个姿势岂不是就没法利用了。这里我们又要了解一个新的相关配置:session.use_strict_mode
该配置项默认是不启用的,这就代表着可以自己定义session id,比如我在请求包中设置Cookie为PHPSESSID=haha,那么就会生成一个sess_haha的session文件,此时php会自动初始化session,并产生一个键值,格式为配置文件中 session.upload_progress.prefix的值+传入的session.upload_progress.name的值,该键值会被写入session文件。按上面写的相关配置,该键值的格式应该为:upload_progress_+PHP_SESSION_UPLOAD_PROGRESS的值。
二:
因为 session.upload_progress.cleanup默认是开启的,这就导致在上传结束后,session文件中有关上传进度的信息会立马被删除,那怎么才能包含到恶意代码呢:
这里可以用条件竞争的方式来解决该问题,使用burp或python脚本不断发送上传数据包,然后再用相同方式发送文件包含的数据包,就能包含到了
边栏推荐
- [solved] how does Tiktok cancel paying attention to the cancelled account
- Enterprise middle office planning and it architecture microservice transformation
- Tensorflow2.4实现RepVGG
- RP prototype resource sharing - shopping app
- Detailed steps for Django to upload excel tables and write data to the database
- VR全景拍摄为什么要加盟?巧借资源实现共赢
- Which brokerage has the lowest commission? In addition, is it safe to open a mobile account?
- DELL R720服务器安装网卡Broadcom 5720驱动
- C语言:hashTable
- How to pass the PMP Exam quickly?
猜你喜欢
计网 | 【五 传输层、六 应用层】知识点及例题
[solved] how does Tiktok cancel paying attention to the cancelled account
NLP技能树学习路线-(一)路线总览
RP prototype resource sharing - shopping app
《微信小程序-基础篇》带你了解小程序中的生命周期(二)
QQmlApplicationEngine failed to load component qrc:/main.qml:-1 No such file or directory
Enterprise middle office planning and it architecture microservice transformation
Solution to rollback of MySQL database by mistake deletion
无线充U型超声波电动牙刷方案开发
Wechat applets - basics takes you to understand the life cycle of applets (2)
随机推荐
arthas调试 确定问题工具包
如何使用robots.txt及其详解
将 EMQX Cloud 数据通过公网桥接到 AWS IoT
RP prototype resource sharing - shopping app
Which brokerage has the lowest commission? In addition, is it safe to open a mobile account?
How unity pulls one of multiple components
MySQL数据库查询优化
MySQL数据库误删回滚的解决
8 - 函数
【ICCV 2019】特征超分检测:Towards Precise Supervision of Feature Super-Resolution for Small Object Detection
VB的基本语法
There are three ways to create instances by reflection (2022.6.6-6.12)
Cv+deep learning network architecture pytoch recurrence series basenets (backbones) (I)
CV+Deep Learning——网络架构Pytorch复现系列——basenets(BackBones)(一)
正则系列之字符类
8 - function
【LeetCode】【SQL】刷题笔记
Unity 如何拖拉多个组件中的一个
【450. 删除二叉搜索树中的节点】
6-1漏洞利用-FTP漏洞利用