zoukankan      html  css  js  c++  java
  • jQuery火箭图标返回顶部代码

    Warmup

    先看hint

     
    image.png


    看url有file参数,感觉可能要用伪协议啥的,试了下,没出东西
    扫一下目录,发现http://warmup.2018.hctf.io/source.php源码文件
    源码如下

    <?php
        class emmm
        {
            public static function checkFile(&$page)
            {
                $whitelist = ["source"=>"source.php","hint"=>"hint.php"];
                if (! isset($page) || !is_string($page)) {
                    echo "you can't see it";
                    return false;
                }
    
                if (in_array($page, $whitelist)) {
                    return true;
                }
    
                $_page = mb_substr(
                    $page,
                    0,
                    mb_strpos($page . '?', '?')
                );
                if (in_array($_page, $whitelist)) {
                    return true;
                }
    
                $_page = urldecode($page);
                $_page = mb_substr(
                    $_page,
                    0,
                    mb_strpos($_page . '?', '?')
                );
                if (in_array($_page, $whitelist)) {
                    return true;
                }
                echo "you can't see it";
                return false;
            }
        }
    
        if (! empty($_REQUEST['file'])
            && is_string($_REQUEST['file'])
            && emmm::checkFile($_REQUEST['file'])
        ) {
            include $_REQUEST['file'];
            exit;
        } else {
            echo "<br><img src="https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg" />";
        }  
    ?>
    

      

    看了下是文件包含,checkFile函数$_page取file参数第一个问号之前的字段检查文件名是否在白名单内于是构造file参数为hint.php?/../../../../../ffffllllaaaagggg

     


    原理是hint.php?/被当作目录,之后上跳目录就好了(这个只适用于linux)
    测试如下

  • 相关阅读:
    python jinja2模板分页效果
    vscode配置svn
    解决VSCODE打开新文件覆盖上一个窗口的问题
    vue所用插件整理
    vue bus总线
    create-react-app使用less
    react入门
    ES6|Object
    vue轮播插件--vue-awesome-swiper
    js/jq中遍历对象或者数组的函数(foreach,map,each)
  • 原文地址:https://www.cnblogs.com/kuaile1314/p/11722877.html
Copyright © 2011-2022 走看看