当前位置:网站首页>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>
边栏推荐
- The difference between searching forward index and inverted index
- Jarvis OJ 远程登录协议
- 如何安装mysql
- 单商户 V4.4,初心未变,实力依旧!
- Mongodb getting started Tutorial Part 04 mongodb client
- Record a 'very strange' troubleshooting process of cloud security group rules
- Cartoon: what is blue-green deployment?
- 二叉树相关OJ题
- Today's sleep quality record 79 points
- 2020-2022两周年创作纪念日
猜你喜欢

【刷题篇】鹅厂文化衫问题

Pspnet | semantic segmentation and scene analysis

Jarvis OJ Flag
英特尔第13代Raptor Lake处理器信息曝光:更多核心 更大缓存

数据湖(十四):Spark与Iceberg整合查询操作

Research and development efficiency measurement index composition and efficiency measurement methodology

ES6深入—async 函数 与 Symbol 类型
![[61dctf]fm](/img/22/3e4e3f1679a27d8b905684bb709905.png)
[61dctf]fm

Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL

Spring Festival Limited "forget trouble in the year of the ox" gift bag waiting for you to pick it up~
随机推荐
Domestic API management artifact used by the company
Global Data Center released DC brain system, enabling intelligent operation and management through science and technology
Desci: is decentralized science the new trend of Web3.0?
【学术相关】多位博士毕业去了三四流高校,目前惨不忍睹……
解决CMakeList find_package找不到Qt5,找不到ECM
不敢买的思考
数据湖(十四):Spark与Iceberg整合查询操作
[deep learning] [original] let yolov6-0.1.0 support the txt reading dataset mode of yolov5
【漏洞预警】CVE-2022-26134 Confluence 远程代码执行漏洞POC验证与修复过程
记一次'非常诡异'的云安全组规则问题排查过程
The memory of a Zhang
[es6] add if judgment or ternary operator judgment in the template string
Get ready for the pre-season card game MotoGP ignition champions!
10分钟帮你搞定Zabbix监控平台告警推送到钉钉群
scratch五彩糖葫芦 电子学会图形化编程scratch等级考试三级真题和答案解析2022年6月
给自己打打气
[js] 技巧 简化if 判空
PHP strict mode
服务器的数据库连不上了2003,10060“Unknown error“【服务已起、防火墙已关、端口已开、netlent 端口不通】
用键盘输入一条命令