又是被暴打的一集。。。跟上次京麒ctf一样,盯着下面这道misc看了一天,然后成功爆零。。。不想说什么了(T0T)

后来通过与从某些途径搞来的官方wp比对,发现——还是和上次京麒ctf一样,就差最后一步了。。。已经到了flag跟前,然后不会了。。。不说了,开始复现(T0T)

题目

题目给了一个叫做张小可 英语教师简历.png.exe的程序

与答案相同部分

先对这个程序进行查壳(这里改名为了1.exe)

image-20240819213235689

upx脱壳

image-20240819213332522

接下来的步骤正常应该是通过对1.exe逆向,来分析其进行的恶意行为。但是多捣鼓捣鼓也不难弄出来,下面就写我比赛时瞎捣鼓的做法了。

我的方法

foremost分解1.exe,得到简历图片

image-20240819214026169

image-20240819214120025

发现存在lsb隐写,得到一个网址

image-20240819214347437

直接访问,下载得到一个default.a文件

image-20240819214517377

拖进010

image-20240819214817604

可以看到其中存在大量的yyttddd,所以肯定是整体异或yyttddd(这里生成的文件命名为download.exe)

image-20240819215052897

binwalk一下,得到一个叫做14728.7z的文件

image-20240819221321688

7zip识别不出来,用trid识别一下,应该是个lzma压缩文件,改一下后缀

image-20240819221534911

当时比赛的时候我就是卡在这儿了。。。

实际上,只要写个python脚本加载一下数据就行了。。。

1
2
3
4
5
6
7
8
9
10
import marshal
import pylzma

filename = '14728.lzma'

with open(filename, 'rb') as f:
data = f.read()
data = pylzma.decompress(data)
tmp = marshal.loads(data)
print(tmp)

image-20240819221819896

可以看出c2服务器的ip地址就是60.177.118.44:3432

预期方法(后半部分)

前面已经说过了,到异或yyttddd其实都可以通过对1.exe进行逆向推出来,因此这里就不说了,从得到download.exe开始说。

我们将download.exe丢进virustotal分析一下可以发现这其实是一个pupyrat的马

image-20240819223954231

download.exe实际上后面跟着一个lzma格式的配置文件,提取出来就行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import marshal
import pylzma

filename = 'final.exe'

with open(filename, 'rb') as f:
data = f.read()

index = data.find(b'\x5d\x00\x00\x80\x00\x00')
if index == -1:
print("LZMA signature not found, skipped")
else:
data = pylzma.decompress(data[index:])
tmp = marshal.loads(data)
print(tmp)

image-20240819224318318

可以看出c2服务器的ip地址就是60.177.118.44:3432