启航杯网络安全挑战赛-Win取证

背景信息

1
某天,小明正在某网站进行学习。突然,一位蛤客盯上了他,并向他发送了一封钓鱼邮件。由于小明刚接触网络安全,对钓鱼邮件并不熟悉,他不小心下载并点击了邮件中的附件。当他后来学习到钓鱼邮件的相关知识时,已经为时晚矣。于是,他请求你帮助找出蛤客的痕迹。请你针对附件镜像进行一次应急响应,查找以下flag值。压缩包附件的解压密码为:90382728-ca22-48e7-8413-61f6438f1b90。

环境仿真

FTK挂载Windows.E01,导出C:\Windows\System32\config文件夹下的SAM、SYSTEM、SECURITY文件
image-20250126190001740
image-20250126190040548
image-20250126185913440

image-20250126190803348
image-20250126190819932

image-20250126191109519

1
2
3
得到两个用户
admin:123456
HackY$:123456

参考链接

【电子取证:FTK Imager 篇】DD、E01系统镜像动态仿真_accessdata ftk imager教程

Vmware安装虚拟机出现attempting to start up from?

image-20250126190819932

image-20250126194447202
image-20250126194812945

image-20250126194746553
image-20250126194851453

image-20250126194928424
image-20250126195101585

出现以下报错:
image-20250126195156304
关闭虚拟机修改此虚拟机配置文件

image-20250126195430813

image-20250126195532955
将此行删掉再重新启动虚拟机,
使用Admin:123456登陆
image-20250126195748848

题目

1.找出系统中蛤客的ip地址及端口

做最后一题找启动项中藏的flag时
image-20250126211051798
查HackY$用户 发现了可执行程序
image-20250126212025905

2.蛤客在控制小明的系统后,创建了一个最高权限的后门账户,请你找出该账户的用户名及密码

image-20250126191309965

1
2
3
4
5
RID  : 000003eb (1003)
User : HackY$
Hash NTLM: 32ed87bdb5fdc5e9cba88547376818d4
用户名为HackY$
密码为123456

3.蛤客在home目录中存放了一个恶意程序,请你分析该程序,并找到其中的flag值

在Admin桌面下存在Hacker_.exe
image-20250126202952563
是个python打包的exe
pyinstxtractor逆向
python pyinstxtractor.py Hacker_.exe
image-20250126235404813

image-20250126203827121
添加magic number
image-20250126203607426
Pycdc反编译或者在线网站转pyc

image-20250126203942409源代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Decompiled with PyLingual (https://pylingual.io)
# Internal filename: 1.py
# Bytecode version: 3.11a7e (3495)
# Source timestamp: 1970-01-01 00:00:00 UTC (0)

from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
import base64

def xor_encrypt(data, key):
return bytes([data[i][key, i, len(key)] for i in range(len(data))])

def aes_encrypt(key, data):
cipher = AES.new(key, AES.MODE_ECB)
encrypted_data = cipher.encrypt(pad(data.encode('utf-8'), AES.block_size))
return encrypted_data

def encrypt_message(aes_key, message):
aes_encrypted = aes_encrypt(aes_key, message)
base64_encoded = base64.b64encode(aes_encrypted)
xor_key = b'qihangcup'
xor_encrypted = xor_encrypt(base64_encoded, xor_key)
final_encrypted = base64.b64encode(xor_encrypted).decode('utf-8')
return final_encrypted
if __name__ == '__main__':
aes_key = b'acf8bafa15f8cb03'
message = 'QHCTF{xxxxxxxxxx}'
encrypt_message1 = 'HgIlNCQUF0MZRA0FMhwODBsTNjM4OQ8RMA81SCImFhQeVkQdCUJfMBs0Mx0fGVowIyoTJ0cdHCwKVwxIOQQCRA=='
encrypted_message = encrypt_message(aes_key, message)
print('加密结果:', encrypted_message)

解密脚本(用了网上一位师傅的脚本)

1
2
3
4
5
解密:逻辑
将密文enc进行Base64解码。
使用 XOR 密钥进行解密。
再次进行 Base64 解码。
使用 AES 密钥进行 AES-ECB 模式解密
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad

def xor_encrypt(data, key):
a = ''
for i in range(len(data)):
a += chr(data[i] ^ key[i % len(key)])
return a.encode('utf-8')

enc = "HgIlNCQUF0MZRA0FMhwODBsTNjM4OQ8RMA81SCImFhQeVkQdCUJfMBs0Mx0fGVowIyoTJ0cdHCwKVwxIOQQCRA=="
data = base64.b64decode(enc)

xor_key = b'qihangcup'
xor_encrypted = xor_encrypt(data, xor_key)

data = base64.b64decode(xor_encrypted)

aes_key = b'acf8bafa15f8cb03'
cipher = AES.new(aes_key, AES.MODE_ECB)
decrData = unpad(cipher.decrypt(data), AES.block_size)
print(decrData)
# b'QHCTF{8b0c14a8-5823-46fd-a547-0dcdc404a7ed}'

image-20250126200304206
存在flag.zip
image-20250126210314098
提示我们去查环境变量
image-20250126210445603

image-20250126210508893
image-20250126210616459

4.蛤客在系统数据库中藏了一些东西,请你找出其中的flag值

仿真后,Win+R打开运行框 发现历史记录regedit
image-20250126200003571
电脑桌面存在111.reg文件,里面也有此flag

5.小明在找你帮忙之前,喊了他的一位好友帮他先行取证,请你找出他好友远程所使用的软件,并找出控制了多少秒,ip是什么

image-20250126200219074
打开资源管理器 发现大量日志文件,点击打开文件却消失了,可以使用DiskGenius进行恢复,或者将磁盘重新载入

过滤port= 发现唯有这个最特殊
或者查看其他日志 能发现 这段时间在数据传输

1
则就为 223.104.132.99:20000

image-20250126231746593

排查2024-12-23 14:40:01左右的会话
image-20250126232927886

定位到2024-12-23 14:39:59 通过35600端口进行收发数据
image-20250126233113621

image-20250126233238499
在2024-12-23 14:53:00 断开会话,共781s

1
2
3
Todesk
781
223.104.132.99

6.请你找出蛤客在启动项中藏的flag

win + R输入shell:startup
Admin用户中为空

image-20250126211051798
官方说在C∶/Windows/system32/tasks/Microsoft/start
被Windows defender 杀了
将H:\ProgramData\Microsoft\Windows Defender\Quarantine文件夹提取
(也可仿真进行提取)
image-20250127224635052

使用CyberGoatherder/WinDefReleaser: Python tool to parse and decrypt files quarantined by windows defender进行恢复
image-20250127224952739

image-20250127225245700

image-20250127225310518