当前位置:网站首页>文件包含&条件竞争
文件包含&条件竞争
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脚本不断发送上传数据包,然后再用相同方式发送文件包含的数据包,就能包含到了
边栏推荐
- 操作系统面试题汇总(不定期更新)
- 1. 爬虫之Beautifulsoup解析库&在线解析图片验证码
- CADD课程学习(2)-- 靶点晶体结构信息
- 【ICLR 2021】半监督目标检测:Unbiased Teacher For Semi-Supervised Object Detection
- [multithreading] use the thread pool to implement a simple thread pool
- MQ component (2022.5.16-5.22)
- 2022年高考都结束了,还有人真觉得程序员下班后不需要学习吗?
- QQmlApplicationEngine failed to load component qrc:/main.qml:-1 No such file or directory
- neo4j load csv 配置和使用
- 软件工程最佳实践——项目需求分析
猜你喜欢

为什么数字化转型战略必须包括持续测试?

解决arm_release_ver of this libmali is ‘g2p0-01eac0‘,rk_so_ver is ‘4‘,libgl1-mesa-dev不会被安装,存在未满足的依赖关系

Unity 如何拖拉多个组件中的一个

S7-1500 PLC之间进行TCP通信的具体方法和步骤详解(图文)

TorchDrug--药物属性预测

Audio and video architecture construction in the super video era | science and Intel jointly launched the second season of "architect growth plan"

RP原型资源分享-购物类App

软件工程最佳实践——项目需求分析

Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)

Spark - 一文搞懂 Partitioner
随机推荐
Why must a digital transformation strategy include continuous testing?
Graduates
Filebeat custom indexes and fields
Django上传excel表格并将数据写入数据库的详细步骤
[multithreading] use the thread pool to implement a simple thread pool
Cartoon | has Oracle been abandoned by the new era?
启动PHP报错ERROR: [pool www] cannot get uid for user ‘@[email protected]’
Wechat applets - basics takes you to understand the life cycle of applets (2)
小学期,第三场-下午:WEB_xxe
4.3寸触控屏12路控制端口可编程网络中控支持5台中控主机相互备份
正则系列之字符类
VR全景添加对比功能,让差异化效果展示更直观!
mysql统计账单信息(上):mysql安装及客户端DBeaver连接使用
Client请求外部接口标准处理方式
Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)
网易云签到可抽奖?那一年我能签到365天。不信?你看。
腾讯会议应用市场正式上线,首批入驻超20款应用
为什么数字化转型战略必须包括持续测试?
Ten percent of the time, the tar command can't parse the English bracket "()" when decompressing the file
qt中toLocal8Bit和toUtf8()有什么区别