第1关 取证初探
文章目录
题目背景:
Suspicious traffic was detected from a recruiter’s virtual PC. A memory dump of the offending VM was captured before it was removed from the network for imaging and analysis. Our recruiter mentioned he received an email from someone regarding their resume. A copy of the email was recovered and is provided for reference. Find and decode the source of the malware to find the flag.
可疑流量被检测到在HR的虚拟机里。捕获了一个恶意的VM转储的存储之后,把他的网络镜像导出和分析。我们的HR提及他收到了某人的简历。电子邮件的副本被收回并被提供以供参考。解码或寻找这个恶意软件的资源以找到flag
1. 前奏
1.1 eml
.eml后缀,电子邮件格式。
打开方式:
打开网页读邮件
客户端打开(易溯源)
1.2 elf
VirtualBox VboxManage软件中有一个工具可以将其中运行的系统生成一个.elf的镜像
镜像的常见格式:
data/raw/elf
2. 流程
2.1 下载问题文件至Kali/Download
因为/home/kali/Downloads具备读写环境。关注问题点有个超链接,链接到10.10.99.55:8080/resume.zip
会进行下载。若有某个程序和这个系统通讯则可以确定他有问题
文档有时候也会带有病毒(文档安全),
word/excle自带VBA,
pdf针对于早期pdf版本的漏洞,控制整机,
Power Shell Win7后自带软件,经常多次base64编码之后,生成木马
2.2 观察imageinfo(镜像信息)
Suggested Profile(s) : Win7SP1x64, Win7SP0x64, Win2008R2SP0x64, Win2008R2SP1x64_23418, Win2008R2SP1x64, Win7SP1x64_23418
AS Layer1 : WindowsAMD64PagedMemory (Kernel AS)
AS Layer2 : VirtualBoxCoreDumpElf64 (Unnamed AS)
AS Layer3 : FileAddressSpace (/home/infosec/dumps/mem_dumps/01/flounder-pc-memdump.elf)
PAE type : No PAE
DTB : 0x187000L
KDBG : 0xf800027fe0a0L
Number of Processors : 2
Image Type (Service Pack) : 1
KPCR for CPU 0 : 0xfffff800027ffd00L
KPCR for CPU 1 : 0xfffff880009eb000L
KUSER_SHARED_DATA : 0xfffff78000000000L
Image date and time : 2017-10-04 18:07:30 UTC+0000
Image local date and time : 2017-10-04 11:07:30 -0700
据观察,这个HR最可能的机型是Win7SP1x64,生成了镜像
或者可直接使用命令
python /home/kali/Downloads/volatility-master/vol.py -f /home/kali/Downloads/reminiscent/flounder-pc-memdump.elf imageinfo
2.3 镜像取证
2.3.1 查看进程,查看可疑进程,查找赃物
使用volatility
对镜像文件进行取证。直接解压就可以使用。
安装运行setup.py
,直接使用运行vol.py
常用命令
-f =查看的镜像
--profile=系统平台
psscan 查看进程
netscan 查看网络状态
filescan 查找所有的文件
|grep resume 过滤处resume相关的
1.查看进程
python /home/kali/Downloads/volatility-master/vol.py
-f /home/kali/Downloads/reminiscent/flounder-pc-memdump.elf
--profile=Win7SP1x64
psscan
分析进程
Offset(P) Name PID PPID PDB Time created Time exited
------------------ ---------------- ------ ------ ------------------ ------------------------------ ------------------------------
0x000000001fc3d7dc powershell.exe 2752 496 0x000000001bb50000 2017-10-04 18:07:00 UTC+0000
0x000000001e2527dc powershell.exe 496 2044 0x000000000a6bd000 2017-10-04 18:06:58 UTC+0000
一个不会使用电脑的人使用了两个powershell十分可以,此时我们对两个进程的网络状况进行分析
2.网络状况进行分析:
python /home/kali/Downloads/volatility-master/vol.py
-f /home/kali/Downloads/reminiscent/flounder-pc-memdump.elf
--profile=Win7SP1x64
netscan
发现2752的powershell.exe在向那个问题邮件中的地址进行通信
ffset(P) Proto Local Address Foreign Address State Pid Owner Created
0x1fc04490 TCPv4 10.10.100.43:49246 10.10.99.55:80 CLOSED 2752 powershell.exe
2.3.2 查看相关文件
1. 查看文件与其中相关
python /home/kali/Downloads/volatility-master/vol.py
-f /home/kali/Downloads/reminiscent/flounder-pc-memdump.elf
--profile=Win7SP1x64
filescan|grep resume
0x000000001e1f6200 1 0 R--r-- \Device\HarddiskVolume2\Users\user\Desktop\resume.pdf.lnk
0x000000001e8feb70 1 1 R--rw- \Device\HarddiskVolume2\Users\user\Desktop\resume.pdf.lnk
得到问题文件的地址,易发现其是powershell写入pdf中的木马
2. 文件内容分析
volatility -f memory --profile=WinXPSP2x86 dumpfiles -Q 0x00000000053e9658 -D /home/kali/downloads -Q制定了文件物理位置的开始,另一个参数制定了保存的位置。
所以进行写入:
python /home/kali/Downloads/volatility-master/vol.py -f /home/kali/Downloads/reminiscent/flounder-pc-memdump.elf
--profile=Win7SP1x64
dumpfiles -Q 0x000000001e8feb70 -D /home/kali/Downloads
得到了两个文件.dat和.vacb,查看.dat文件。 strings 命令对识别随机对象文件很有用 ,所以用strings进行查看
strings 文件名
2.3.3 解码
由于一般poweshell都是base64编码,且其=号结尾,所以直接进行解码
因为第一行解出来了,由powershell -noP -sta -w 1 -enc
还需再解一次。
此木马由powershell Empire生成
-enc:允许传入一个base64编码过的脚本作为参数执行该脚本,常用于免杀绕过
-nop -sta:不弹窗口
果然成功,得到了flag