2019西湖论剑writeup

babyt3

看到include $_GET['file']尝试文件包含用php://filter读取index文件,成功读取 解码得到如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$a = @$_GET['file'];
if (!$a) {
$a = './templates/index.html';
}
echo 'include $_GET[\'file\']';
if (strpos('flag',$a)!==false) {
die('nonono');
}
include $a;
?>

<!--hint: ZGlyLnBocA== -->

提示有dir.php 继续读取dir.php

1
2
3
4
5
6
<?php
$a = @$_GET['dir'];
if(!$a){
$a = '/tmp';
}
var_dump(scandir($a));

分析:
index.php
获取file值 检查是否出现flag
dir.php
列出目录结构

先在dir.php中查看目录

然后在index.php中读取

解码得到flag

#

#