PHP伪协定
起首,我们须要先相识一下我们在CTF中能够碰到的文件包括函数:
1、include
2、require
3、include_once
4、require_once
5、highlight_file
6、show_source
7、readfile
8、file_get_contents
9、fopen
10、file
(比较罕见)
PHP伪协定事实上就是支撑的协定与封装协定(12种)
a. file:// — 接见当地文件体系
b. http:// — 接见 HTTP(s) 网址
c. ftp:// — 接见 FTP(s) URLs
d. php:// — 接见各个输入/输出流(I/O streams)
e. zlib:// — 紧缩流
f. data:// — 数据(RFC 2397)
g. glob:// — 查找婚配的文件途径形式
h. phar:// — PHP 归档
i. ssh2:// — Secure Shell 2
j. rar:// — RAR
k. ogg:// — 音频流
l. expect:// — 处置惩罚交互式的流
是不是须要截断
1、不须要截断
<?php include($_GET['file']) ?>
2、须要截断 (在php版本<=5.2中举行测试是能够运用%00截断的)
<?php include($_GET['file'].'.php') ?>
file://协定
file://协定在双off的情况下也是能够一般运用的。
allow_url_fopen :off/on
allow_url_include:off/on
file://用于接见当地文件体系,在CTF中常用来读取当地文件。
运用方法:file://文件的绝对途径和文件名。
Eg:http://127.0.0.1/cmd.php?file=file://D:/soft/phpStudy/WWW/phpcode.txt
php://协定
php://协定的运用前提:
1. 不须要开启allow_url_fopen
2. php://input、 php://stdin、 php://memory 和 php://temp 须要开启allow_url_include。
php://filter 用于读取源码且在双off的情况下也能够一般运用
allow_url_fopen :off/on (运用前提)
allow_url_include:off/on
Eg: http://127.0.0.1/cmd.php?file=php://filter/read=convert.base64-encode/resource=index.php
php://input 能够接见要求的原始数据的只读流, 将post要求中的数据作为PHP代码实行。
allow_url_fopen :off/on
allow_url_include:on
Eg:http://127.0.0.1/cmd.php?file=php://input [POST DATA] <?php phpinfo()?>
以上内容仅供参考!
引荐教程:PHP视频教程
以上就是php伪协定是什么的细致内容,更多请关注ki4网别的相干文章!