zoukankan      html  css  js  c++  java
  • bugku flag在index里

    原题内容:

    http://120.24.86.145:8005/post/

     

    Mark一下这道题,前前后后弄了两个多小时,翻了一下别的博主的wp感觉还是讲的太粗了,这里总结下自己的理解:

     

    首先打开这道题,页面只给你click me? no

    点击进去显示test5

     

    第一步,查看源代码,无果

    第二步bp,无果

    结合到题目,flag在index里,大胆尝试http://120.24.86.145:8005/post/index.php,可惜和之前一样

    注意到了传值为http://120.24.86.145:8005/post/index.php?file=show.php

    file这个变量应该是关键,可惜无果

     

    参考到别的博主的wp:

    file传值为

     

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

     

     

    结果如下:


    base64解密下就得到flag了

     

    可能很多人到这里并不太理解,这里我做具体解释:
    首先来解释下这段代码的意思:

    即以base64加密的方式读取resource的内容

     

    然后我们来看一下php://filter的限制

    要求将传进来的参数进入include();在这题即是$file //这里就打乱了我的胡思乱想,哈哈哈,还以为所有题目都可以呢

    这点要求在后来拿到的题目源码中也可确认:

     

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

     

     

    下面演示通过php://filter读取本包含漏洞脚本的源码

    接下来只要将base64编码后的字符串通过base64解码就可得到PHP文件的源码了



    看到一个大佬的博客讲的特别棒,我已转载至我的博客,大家可以前去一看

    谈一谈php://filter的妙用

     

     

    参考原文

    http://blog.csdn.net/qq_35078631/article/details/69488266

    http://www.freebuf.com/articles/web/14097.html

     
    ————————————————
    版权声明:本文为CSDN博主「Sp4rkW」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/wy_97/article/details/77431111

  • 相关阅读:
    作业20170928--2 单元测试
    作业20170928—1代码规范,结对要求
    第三周PSP
    20170922-3 功能测试作业
    第二周PSP
    采用c#实现功能1
    linux下搭建生成HLS所需的.ts和.m3u8文件
    android编译ffmpeg+x264
    ubuntu.sh: 113: ubuntu.sh: Syntax error: "(" unexpected
    解决:[WARNING] fpm_children_bury(), line 215: child 2736 (pool default) exited on signal 15 SIGTERM after 59.588363 seconds from start
  • 原文地址:https://www.cnblogs.com/ainv-123/p/12094335.html
Copyright © 2011-2022 走看看