(i春秋 Misc)ReCreators-CryMisc

⭐【i春秋 Misc】

【题目链接】 i春秋 Misc ReCreators CryMisc

⭐ReCreators

下载得到一个文件。老规矩,放入010文本编辑器中查看:

文件头是: KDMV 不清楚。 往下查看:

(i春秋 Misc)ReCreators-CryMisc

发现了 misc.vmdk 可通过 file 命令直接查看,得到如下:

root@DESKTOP-VUB6KKI:/mnt/c/Users/11145/Desktop# file ReCREATORS
ReCREATORS: VMware4 disk image

文件格式: .vmdk

文件类型: Virtual Machine Disk File

即 与虚拟机中虚拟磁盘文件有关。

可知: ReCREATORS 是虚拟机映像文件。 修改后缀名为 : ReCREATORS.vmdk

磁盘文件,立刻想到 一个叫 DiskGenius 的软件。

通过 打开磁盘文件 将 ReCREATORS.vmdk 加载进来。然后依次进入,发现一个MP4

(i春秋 Misc)ReCreators-CryMisc

将该mp4导出,打开一听是一首动漫主题曲。 用 010打开查看,在最后一段发现异常数据。

(i春秋 Misc)ReCreators-CryMisc

全是一串数据。导出 ,怀疑是 ASCII转换,保存为 1.hex

参考大佬脚本题解

(ps:该脚本可适用 得到一堆ASCII文本,通过base16(十六进制转换)/32/64层层解密得出flag 的情况)

import binascii
import base64

def get_continuous_asciis(ranges: list):
"""
    取连续的ASCII文本
    :param ranges: 范围数组, 例[['A', 'B']]
    :return:
"""
    return ''.join([''.join(map(chr, range(ord(r[0]), ord(r[1]) + 1))) for r in ranges])

with open('E:\\1.hex') as f:
    enc = f.read()

while True:
    b16 = b32 = b64 = False
    if all([i.upper() in '0123456789ABCDEF' for i in enc]):
        b16 = True
    elif all([i.upper() in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ2345678=' for i in enc]):
        b32 = True
    elif all([i.upper() in get_continuous_asciis([['a', 'z'], ['A', 'Z'], ['0', '9']]) + '+/=' for i in enc]):
        b64 = True
    else:
        # print('End')
        break
    if b16:
        # print('Base16')
        enc = binascii.a2b_hex(enc).decode('utf-8')
    elif b32:
        # print('Base32')
        enc = base64.b32decode(enc).decode('utf-8')
    elif b64:
        # print('Base64')
        enc = base64.b64decode(enc).decode('utf-8')
    # print('-' * 30)
    print(enc)
    print('-' * 30)

得到flag:

⭐CryMisc

下载得到一个压缩包,解压得到一个 jiami.py 加密脚本 和一个 被加密的压缩包 gogogo.zip

jiami.py 如下:

-*- coding:utf8 -*-

import pyminizip
from hashlib import md5
import os

def create(files, zfile):
    password = os.urandom(15)
    password = md5(password).hexdigest()
    pyminizip.compress_multiple(files, zfile, password, 0)
    pass

if __name__ == '__main__':
    files = ['jiami.py','gogogo.zip']
    zfile = 'crypto.zip'
    create(files, zfile)

通过这个加密脚本 ,很清楚的看到, 是将 jiami.pygogogo.zip 一起加密成 crypto.zip

并且注意到 这是通过 15位md5加密而成,爆破难度顶天。

由于已知一个和被加密压缩包一样加密算法的文件,便可马上想到 明文攻击

1、将 jiami.py 用winrar 压缩成一个压缩包 -> jiami,zip 当作 明文

(可能是压缩算法原因,对于明文攻击,目前来看,必须采用winrar方可成功)

2、打开ARCHPR 爆破压缩包神器。将加密zip gogogo.zip 导入,选择 明文攻击类型

3、进行明文攻击。

注:对于ARCHPR4.0版本,它会自动跳出,只需等待就可。

而ARCHPR4.54版本,攻击一段时间,直接按下停止即可,如下图:

(i春秋 Misc)ReCreators-CryMisc

它会自动跳出 另存为解密压缩包

(i春秋 Misc)ReCreators-CryMisc

解压解密成功的压缩包,得到三个文件: AES.encrytAESencrypt.pyRSA.encrypt

打开 AESencrypt.py

-*- coding:utf8 -*-
from Crypto.Cipher import AES

s=open('next.zip','rb').read()
BS=16
pad_len=BS-len(s)%BS
padding=chr(pad_len)*pad_len
s+=padding

key='我后来忘了'
n=0x48D6B5DAB6617F21B39AB2F7B14969A7337247CABB417B900AE1D986DB47D971
e=0x10001
m=long(key.encode('hex'),16)
c=pow(m,e,n)
c='0{:x}'.format(c).decode('hex')
with open('RSA.encrypt','wb') as f:
    f.write(c)

obj=AES.new(key,AES.MODE_ECB)
with open('AES.encryt','wb') as f:
    f.write(obj.encrypt(s))

这里给了我们很多信息:

1、有一个 next.zip 的存在

2、key 是经过 RSA加密

3、一开始是AES加密。

解密RSA得到key

已知 n,利用 yafu 分解 n得到p q 或者 在线网站分解

n = 32945885482421841602167475970472000545315534895409154025267147105384142461297

得到:

(i春秋 Misc)ReCreators-CryMisc
p = 177334994338425644535647498913444186659
q = 185783328357334813222812664416930395483

编写脚本:

#coding:utf-8
import gmpy2
import binascii
from Crypto.Util.number import long_to_bytes
p = 177334994338425644535647498913444186659
q = 185783328357334813222812664416930395483
n = 32945885482421841602167475970472000545315534895409154025267147105384142461297
e = 0x10001
d = int(gmpy2.invert(e,(p-1)*(q-1)))
mingwen = open("E:\\RSA.encrypt","rb").read()
hexstr = binascii.b2a_hex(mingwen).decode("utf-8")
c = int(hexstr,16)
m = pow(c, d, n)  # m 的十进制形式
string = long_to_bytes(m)  # m明文
print(string)  # 结果为 b' m ' 的形式

跑出结果如下:

(i春秋 Misc)ReCreators-CryMisc

得到 key: copy__white__key

得到key解密生成next.zip

利用已知 AESencrypt.py 编写解密脚本 获得 next.zip python2脚本如下

from Crypto.Cipher import AES

s=open('AES.encryt','rb').read()
BS=16
pad_len=BS-len(s)%BS
padding=chr(pad_len)*pad_len
s+=padding

key='copy__white__key'

obj=AES.new(key,AES.MODE_ECB)
with open('next.zip','wb') as f:
f.write(obj.decrypt(s))

运行得到 next.zip 查看 encrypt.py :

-*- coding:utf8 -*-
from base64 import *

s=open('flag.jpg','rb').read()
s='-'.join(map(b16encode,list(s)))
s=map(''.join,zip(*(s.split('-'))))
with open('first','wb') as f:
f.write(b16decode(s[0]))
with open('second','wb') as f:
f.write(b16decode(s[1]))

加密脚本传递的信息为:

将 一张flag.jpg 分成一半。first和second,并且对其两部分均使用base16 decode一次。

编写脚本得flag.jpg

于是 可以编写解密脚本(python2):

-*- coding:utf8 -*-
from base64 import *
s = [0,1]
with open('first','rb') as f:
s[0] = b16encode(f.read())
with open('second','rb') as f:
s[1] = b16encode(f.read())
s=map(''.join,zip(*s))
s=b16decode(''.join(s))
with open('flag.jpg','wb') as f:
    f.write(s)

得到flag.jpg

(i春秋 Misc)ReCreators-CryMisc

用010打开查看,利用插件,注意到最后有大段数据段异常填充,

点击查看发现 8BPS psd文件头! 于是截下另存为 psd。

(i春秋 Misc)ReCreators-CryMisc

用ps打开 。疑似flag的假的flag出现。于是 将背景图层导出png查看。

为什么要导出背景图层?

1、该图就三个图层:

一个是文字图层(迷惑行为),还有一个是图片表情包。背景图层(锁定)flag藏在这里最有可能。

2、 之前得到的key: copy__white__key 暗示导出png格式

(i春秋 Misc)ReCreators-CryMisc

用 stegsolve查看:

(i春秋 Misc)ReCreators-CryMisc

扫描二维码得flag

(i春秋 Misc)ReCreators-CryMisc

flag为:

flag{409d7b1e-3932-11e7-b58c-6807154a58cf}

【侵权删】

【转载请放链接】 https://www.cnblogs.com/Jlay/p/CryMisc.html

Original: https://www.cnblogs.com/Jlay/p/CryMisc.html
Author: J1ay
Title: (i春秋 Misc)ReCreators-CryMisc

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/574158/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球