[BUUCTF]-[网鼎杯 2020 半决赛]AliceWebsite

首先看了界面有home和about,但都没啥东西。也遍历不到.git robots.txt等东西

那就只能看buuctf给的zip文件了,里面有源码

//about.php
<?php
echo "
        <h1>I'm Alice.</h1>
        <h2>A beginner in web development.</h2>
";
//home.php
<?php
echo "
        <div class='jumbotron'>
            <h1>Here is Alice's Website!</h1>
            <p>Because it has not been developed yet, there are only a few functions.</p>
            <p><a class='btn btn-primary btn-lg' href='index.php?action=about.php' role='button'>About Me</a></p>
        </div>
";
//index.php
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>Wecome to Alice's Website!</title>
    <link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">Alice's Website</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.php?action=home.php">Alice's Website</a>
            </div>
            <div id="navbar" class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="index.php?action=home.php">Home</a></li>
                    <li><a href="index.php?action=about.php">About</a></li>
                </ul>
            </div>
        </div>
    </nav>
    <div class="container" style="padding-top: 5%">
        <?php
        $action = (isset($_GET['action']) ? $_GET['action'] : 'home.php');
        if (file_exists($action)) {
            include $action;
        } else {
            echo "File not found!";
        }
        ?>
    </div>
</body>
</html>

只有index.php有核心代码

        <?php
        $action = (isset($_GET['action']) ? $_GET['action'] : 'home.php');
        if (file_exists($action)) {
            include $action;
        } else {
            echo "File not found!";
        }
        ?>

所以这道题就很明显,要去利用这个include文件包含函数

要去读取index.php?action=参数

我们直接读取flag即可

/index.php?action=/flag 


微信公众号关注【网络安全干货精选】了解更多网安干货知识!

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值