防守更聪明,而不是更难

0x01 前言

CyberDefenders 是一个蓝队培训平台,专注于网络安全的防御方面,以学习、验证和提升网络防御技能。使用cyberdefenders的题目来学习恶意流量取证,题目来自真实环境下产生的流量,更有益于我们掌握取证的流程和相关工具的使用,学习攻击者的攻击思路以便于防御者给出更好的解决办法。

0x02 题目简介

题目链接

难度

中等

解压密码

cyberdefenders.org

案情介绍

1
2
A memory image was taken from a seized Windows machine. Analyze the image and answer the provided questions.
从被扣押的Windows机器中获取了内存图像。分析图像并回答提供的问题。

推荐工具

前置知识

volatility 3语法

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
python3 vol.py [plugin] -f [image]

常用插件:
layerwriter:列出内存镜像platform信息
linux.bash:从内存中恢复bash命令历史记录
linux.check_afinfo:验证网络协议的操作功能指针
linux.check_syscall:检查系统调用表中的挂钩
linux.elfs:列出所有进程的所有内存映射ELF文件
linux.lsmod:列出加载的内核模块
linux.lsof:列出所有进程的所有内存映射
linux.malfind:列出可能包含注入代码的进程内存范围
linux.proc:列出所有进程的所有内存映射
linux.pslist:列出linux内存映像中存在的进程
linux.pstree:列出进程树
mac.bash:从内存中恢复bash命令历史记录
mac.check_syscall:检查系统调用表中的挂钩
mac.check_sysctl:检查sysctl处理程序的挂钩
mac.check_trap_table:检查trap表中的挂钩
mac.ifconfig:列出网卡信息
mac.lsmod:列出加载的内核模块
mac.lsof:列出所有进程的所有内存映射
mac.malfind:列出可能包含注入代码的进程内存范围
mac.netstat:列出所有进程的所有网络连接
mac.psaux:恢复程序命令行参数
mac.pslist:列出linux内存映像中存在的进程
mac.pstree:列出进程树
mac.tasks:列出Mac内存映像中存在的进程
windows.info:显示正在分析的内存样本的OS和内核详细信息
windows.callbacks:列出内核回调和通知例程
windows.cmdline:列出进程命令行参数
windows.dlldump:将进程内存范围DLL转储
windows.dlllist:列出Windows内存映像中已加载的dll模块
windows.driverirp:在Windows内存映像中列出驱动程序的IRP
windows.driverscan:扫描Windows内存映像中存在的驱动程序
windows.filescan:扫描Windows内存映像中存在的文件对象
windows.handles:列出进程打开的句柄
windows.malfind:列出可能包含注入代码的进程内存范围
windows.moddump:转储内核模块
windows.modscan:扫描Windows内存映像中存在的模块
windows.mutantscan:扫描Windows内存映像中存在的互斥锁
windows.pslist:列出Windows内存映像中存在的进程
windows.psscan:扫描Windows内存映像中存在的进程
windows.pstree:列出进程树
windows.procdump:转储处理可执行映像
windows.registry.certificates:列出注册表中存储的证书
windows.registry.hivelist:列出内存映像中存在的注册表配置单元
windows.registry.hivescan:扫描Windows内存映像中存在的注册表配置单元
windows.registry.printkey:在配置单元或特定键值下列出注册表项
windows.registry.userassist:打印用户助手注册表项和信息
windows.ssdt:列出系统调用表
windows.strings:读取字符串命令的输出,并指示每个字符串属于哪个进程
windows.svcscan:扫描Windows服务
windows.symlinkscan:扫描Windows内存映像中存在的链接

0x03 解题过程

0x03_1 What time was the RAM image acquired according to the suspect system? (YYYY-MM-DD HH:MM:SS)

解题

思路:使用volatility 3输入以下命令查看machine的信息

1
python3 vol.py -f /home/kali/桌面/1.mem windows.info

从上图可知RAM镜像采集的时间是SystemTime 2021-04-30 17:52:19

答案

​ 根据可疑系统,RAM镜像2021-04-30 17:52:19采集的

0x03_2 What is the SHA256 hash value of the RAM image?

思路:因为镜像的SHA256是不改变的,我们可以使用Windows或者linux提供的命令行进行计算SHA256

方法一:在Windows系统中输入下面的命令

1
certutil -hashfile C:\Users\XXXXX\Desktop\1.mem SHA256

image-20230419152944021

方法一:在Linux系统中输入下面的命令

1
sudo sha256sum /home/kali/桌面/1.me

image-20230419153219880

答案

​ RAM 映像的 SHA256 哈希值是9db01b1e7b19a3b2113bfb65e860fffd7a1630bdf2b18613d206ebf2aa0ea172

0x03_3 What is the process ID of “brave.exe”?

解题

思路:使用volatility 3输入以下命令查看brave.exe进程的信息

1
python3 vol.py -f /home/kali/桌面/1.mem windows.pslist.PsList | grep brave.exe

image-20230419153659520

答案

brave.exe进程ID4856

0x03_4 How many established network connections were there at the time of acquisition? (number)

解题

思路

方法一:

使用volatility 3输入以下命令查看已经建立(established)的网络的信息,将输出的信息放到1.txt中

1
python3 vol.py -f /home/kali/桌面/1.mem windows.netscan.NetScan  > 1.txt  

image-20230419154708887

使用软件查看established字段的数量

image-20230419154623424

方法二:

使用volatility 3输入以下命令查看已经建立(established)的网络的信息(在linux系统下注意大小写ESTABLISHED为全大写)

1
python3 vol.py -f /home/kali/桌面/1.mem windows.netscan.NetScan | grep 'ESTABLISHED' 

image-20230419160000518

答案

​ 已建立10个网络连接

0x03_5 What FQDN does Chrome have an established network connection with?

解题

思路:使用volatility 3输入以下命令查看Chrome 已经建立的网络连接

1
python3 vol.py -f /home/kali/桌面/1.mem windows.netscan.NetScan | grep 'ESTABLISHED' 

image-20230419160310705

从上图可知Chrome建立的链接的ip是185.70.41.130,使用在线ip解析网站查询信息

image-20230419160454668

答案

​ Chrome 与 FQDN为protonmail.ch建立了网络连接

0x03_6 What is the MD5 hash value of process executable for PID 6988?

解题

思路:使用volatility 3输入以下命令

1
python3 vol.py -f /home/kali/桌面/1.mem windows.pslist.PsList --pid=6988 --dump 

生成了pid.6988.0x1c0000.dmp,接着使用linux提供的MD5 hash计算命令计算

1
md5sum pid.6988.0x1c0000.dmp 

image-20230419161038140

答案

​ PID 6988 的进程可执行文件的 MD5 哈希值是0b493d8e26f03ccd2060e0be85f430af

0x03_7 What is the word starting at offset 0x45BE876 with a length of 6 bytes?

解题

思路:使用HDX工具加载镜像文件,搜索0x45BE876

选择跳转选项

image-20230419161450941

输入地址,选择下面的内容

image-20230419161554718

image-20230419161628922

答案

​ 从偏移量0x45BE876开始,长度为 6 个字节的单词是hacker

0x03_8 What is the creation date and time of the parent process of “powershell.exe”? (YYYY-MM-DD HH:MM:SS)

解题

思路

pid: 本进程

ppid:进程的父进程

首先使用volatility 3输入以下命令查看powershell.exe的父进程ppid

1
python3 vol.py -f /home/kali/桌面/1.mem windows.pslist.PsList

image-20230419162225060

接着使用volatility 3输入以下命令查看ppid为4352的信息

1
python3 vol.py -f /home/kali/桌面/1.mem windows.pslist.PsList | grep 4352 

image-20230419163050287

第一列对应的是pid,我们查看pid为4352的,可以看到创建时间为2021-04-30 17:39:48

答案

​ “powershell.exe”父进程的创建日期和时间是2021-04-30 17:39:48

0x03_9 What is the full path and name of the last file opened in notepad?

解题

思路:因为cmd中可以查看到notepad打开的内容是什么,所以使用volatility 3输入以下命令

1
python3 vol.py -f /home/kali/桌面/1.mem windows.cmdline.CmdLine | grep notepad

image-20230419163600865

答案

​ 在记事本中打开的最后一个文件的完整路径和名称是C:\Users\JOHNDO~1\AppData\Local\Temp\7zO4FB31F24\accountNum

0x03_10 How long did the suspect use Brave browser? (hh:mm:ss)

解题

知识

什么是注册表?

注册表是用于存储Windows系统用户,硬件和软件的存储配置信息的数据库。虽然注册表是为了配置系统而设计的,但它可以跟踪用户的活动,连接到系统的设备,什么时间什么软件被使用过等都将被记录在案。所有这些都可用于取证人员,分析溯源用户的恶意或非恶意行为。

UserAssist可以追踪可执行程序以及资源管理器中打开的链接,UserAssist键能够追踪文件的最后一次执行时间以及执行次数,并将信息存储在下面这个注册表键中.

思路:使用volatility 3输入以下命令,查看注册表中的userassist

1
python3 vol.py -f /home/kali/桌面/1.mem windows.registry.userassist.UserAssist | grep -i brave

image-20230419170056346

答案

​ 嫌疑人使用brave浏览器的时长为:04:01:54