[BJDCTF2020]Mark loves cat

首先打开题目

 首先每个能点的按钮点一下,发现都是回到最顶上。

于是我开始查看源代码。

把源代码拖到最底下发现有一个不起眼的dog

 

 

 然后尝试抓包。

 

 

 实在没办法了,然后从github上面把源代码下载下来了

这是flag.php里面的

<?php

$flag = file_get_contents('/flag');

?>

 

这是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;

联想最开始的dog

所以这个代码应该是从exit($yds)出来了

于是我直接get传参

  ?yds=flag

就可以得到答案了。

又或者我们get传参

  ?is=flag&flag=flag

也可以得到答案,答案就在源代码里面。

 

posted @ 2022-02-09 23:22  FPointmaple  阅读(150)  评论(1编辑  收藏  举报