欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

BUUCTF-web-[极客大挑战 2019]Secret File

程序员文章站 2022-07-16 16:05:58
...

BUUCTF-web-[极客大挑战 2019]Secret File查看源码之后发现achieve_room.php
BUUCTF-web-[极客大挑战 2019]Secret File点击secret,发现end.php
BUUCTF-web-[极客大挑战 2019]Secret File提示回去再仔细看看,查看achieve.php的源代码
BUUCTF-web-[极客大挑战 2019]Secret File发现action.php,访问,然而依旧回到了end.php
BUUCTF-web-[极客大挑战 2019]Secret File说明这个跳转的时间特别快,我们需要抓包,有一个抓包神器BrupSuite,使用它发现action有一个隐藏的回应
BUUCTF-web-[极客大挑战 2019]Secret FileBUUCTF-web-[极客大挑战 2019]Secret File

<html>
    <title>secret</title>
    <meta charset="UTF-8">
<?php
    highlight_file(__FILE__);
    error_reporting(0);
    $file=$_GET['file'];
    if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){//过滤了一些字符
        echo "Oh no!";
        exit();
    }
    include($file); 
//flag放在了flag.php里
?>
</html>

直接访问试试,发现没有
BUUCTF-web-[极客大挑战 2019]Secret File这里可以用php伪协议来读取flag.php
构造playload:

?file=php://filter/convert.base64-encode/resource=flag.php 

BUUCTF-web-[极客大挑战 2019]Secret File
得到并base64解码得flag
BUUCTF-web-[极客大挑战 2019]Secret File小结:使用php伪协议去读取的原因?
返回审计php代码,发现文件包含,结合题目一下想到的文件隐藏,于是我们猜测flag在后端文件中,并需要我们去读取他,传入的file经过了过滤,但是没有过滤filter

相关标签: CTF