volatility2与3使用笔记

需分析内容

  • 系统进程信息
    • pstree
    • psaux
  • 系统网络信息
  • 系统打开文件

提供标识LiME制作内存镜像文件, 可以利用banner中关键词搜索“Linux Version”找到相关的内核版本. 从而再进一步选择Volatility2Profile或者Volatility3Symbols.

volatility3

前言

Linux

模块列表

模块名称 简要功能介绍
plugins.linux.bash 提取和分析Bash历史记录
plugins.linux.check_afinfo 检查网络地址族信息
plugins.linux.check_creds 检查和提取进程凭证信息
plugins.linux.check_idt 检查和分析中断描述表 (IDT)
plugins.linux.check_modules 检查已加载的内核模块
plugins.linux.check_syscall 检查和分析系统调用表 (Syscall Table)
plugins.linux.elfs 检查和分析 ELF 格式的二进制文件
plugins.linux.envars 提取和分析环境变量
plugins.linux.envvars 提取和分析环境变量
plugins.linux.iomem 提取和分析物理内存映射
plugins.linux.keyboard_notifiers 检查和分析键盘事件通知
plugins.linux.kmsg 提取和分析内核消息缓冲区 (KMSG)
plugins.linux.lsmod 列出已加载的内核模块
plugins.linux.lsof 列出打开的文件和进程
plugins.linux.malfind 检测并分析可能的恶意进程
plugins.linux.mountinfo 提取和分析挂载信息
plugins.linux.proc 提取和分析进程信息
plugins.linux.psaux 列出详细的进程信息
plugins.linux.pslist 列出进程列表
plugins.linux.psscan 扫描物理内存以查找进程结构
plugins.linux.pstree 列出进程层次结构
plugins.linux.sockstat 提取和分析网络套接字信息
plugins.linux.tty_check 检查和分析tty设备

MacOS

模块列表

模块名称 简要功能介绍
plugins.mac.bash 提取和分析Bash历史记录
plugins.mac.check_syscall 检查和分析系统调用表 (Syscall Table)
plugins.mac.check_sysctl 检查和分析系统控制变量
plugins.mac.check_trap_table 检查和分析陷阱表 (Trap Table)
plugins.mac.ifconfig 获取和分析网络接口配置信息
plugins.mac.kauth_listeners 列出内核认证侦听器
plugins.mac.kauth_scopes 列出内核认证范围
plugins.mac.kevents 检查和分析内核事件 (Kevents)
plugins.mac.list_files 列出文件和目录
plugins.mac.lsmod 列出已加载的内核模块
plugins.mac.lsof 列出打开的文件和进程
plugins.mac.malfind 检测并分析可能的恶意进程
plugins.mac.mount 检查和分析挂载信息
plugins.mac.netstat 提取和分析网络连接信息
plugins.mac.proc_maps 提取和分析进程内存映射
plugins.mac.psaux 列出详细的进程信息
plugins.mac.pslist 列出进程列表
plugins.mac.pstree 列出进程层次结构
plugins.mac.socket_filters 检查和分析套接字过滤器
plugins.mac.timers 检查和分析内核计时器 (Timers)
plugins.mac.trustedbsd 检查和分析TrustedBSD模块
plugins.mac.vfsevents 检查和分析VFS事件

Windows

模块列表

模块名称 简要功能介绍 用法
plugins.windows.registry 用于操作和分析Windows注册表的模块
plugins.windows.bigpools 分析和提取Windows大内存池中的对象
plugins.windows.cachedump 导出和分析Windows缓存的模块
plugins.windows.callbacks 分析和提取Windows回调函数的模块
plugins.windows.cmdline 提取和分析Windows进程的命令行参数
plugins.windows.crashinfo 提取和分析Windows崩溃转储信息
plugins.windows.devicetree 分析和提取Windows设备树的模块
plugins.windows.dlllist 列出Windows进程加载的DLL模块 vol.py -f “/path/to/file” windows.dlllist ‑‑pid
plugins.windows.driverirp 分析和提取Windows驱动程序的IRP调用
plugins.windows.drivermodule 分析和提取Windows驱动程序模块的模块
plugins.windows.driverscan 扫描物理内存以查找Windows驱动程序结构
plugins.windows.dumpfiles 导出和分析Windows进程的内存转储 vol.py -f “/path/to/file” -o “/path/to/dir” windows.dumpfiles ‑‑pid
plugins.windows.envars 提取和分析Windows进程的环境变量
plugins.windows.filescan 在物理内存中扫描文件结构
plugins.windows.getservicesids 获取Windows服务的安全标识符
plugins.windows.getsids 获取Windows进程和线程的安全标识符
plugins.windows.handles 列出Windows进程的句柄和对象(PID、进程、偏移量、句柄值、类型、grantedaccess、名称) vol.py -f “/path/to/file” windows.handles ‑‑pid
plugins.windows.hashdump 导出和分析Windows密码哈希值
plugins.windows.info 提取和分析Windows系统信息 vol.py -f “/path/to/file” windows.info
plugins.windows.joblinks 检查和分析Windows作业链接
plugins.windows.ldrmodules 列出Windows进程加载的模块
plugins.windows.lsadump 导出和分析Windows本地安全认证信息
plugins.windows.malfind 检测并分析可能的恶意进程
plugins.windows.mbrscan 扫描物理内存中的主引导记录
plugins.windows.memmap 列出物理内存映射 vol.py -f “/path/to/file” -o “/path/to/dir” windows.memmap ‑‑dump ‑‑pid
plugins.windows.mftscan 扫描物理内存中的Master File Table (MFT)
plugins.windows.modscan 扫描物理内存中的模块结构
plugins.windows.modules 列出Windows进程加载的模块
plugins.windows.mutantscan 扫描物理内存以查找Windows互斥体结构
plugins.windows.netscan 扫描物理内存以查找Windows网络连接结构
plugins.windows.netstat 提取和分析Windows网络连接信息
plugins.windows.poolscanner 扫描物理内存以查找Windows内存池结构
plugins.windows.privileges 列出Windows进程的特权
plugins.windows.pslist 列出Windows进程列表
plugins.windows.psscan 扫描物理内存以查找Windows进程结构
plugins.windows.pstree 列出Windows进程层次结构
plugins.windows.sessions 列出Windows登录会话
plugins.windows.skeleton_key_check 检查是否存在Skeleton Key攻击
plugins.windows.ssdt 分析和提取Windows系统服务描述符表 (SSDT)
plugins.windows.strings 提取和分析Windows进程中的字符串
plugins.windows.svcscan 扫描物理内存以查找Windows服务结构
plugins.windows.symlinkscan 扫描物理内存以查找Windows符号链接结构
plugins.windows.vadinfo 提取和分析Windows虚拟地址描述符 (VAD)
plugins.windows.vadwalk 遍历Windows虚拟地址描述符 (VAD)
plugins.windows.verinfo 提取和分析Windows可执行文件版本信息
plugins.windows.volshell 在Windows上运行Volatility命令
plugins.windows.wintree 列出Windows窗口层次结构
plugins.windows.yarascan 使用YARA规则扫描Windows内存

注册表

1
2
3
4
5
6
7
vol.py -f "/path/to/file" windows.registry.hivescan

vol.py -f "/path/to/file" windows.registry.hivelist

vol.py -f "/path/to/file" windows.registry.printkey

vol.py -f "/path/to/file" windows.registry.printkey ―key "Software\Microsoft\Windows\CurrentVersion"

转储文件

1
2
3
4
vol.py -f "/path/to/file" -o "/path/to/dir" windows.dumpfiles
vol.py -f "/path/to/file" -o "/path/to/dir" windows.dumpfiles ‑‑pid <PID>
vol.py -f "/path/to/file" -o "/path/to/dir" windows.dumpfiles ‑‑virtaddr <offset>
vol.py -f "/path/to/file" -o "/path/to/dir" windows.dumpfiles ‑‑physaddr <offset>

volatility2

Windows

参考链接:Volatility学习笔记 - DIDCTF-Blog

基础信息

检测这个内存镜像是哪个操作系统的内存镜像以及各种内存信息

1
2
volatility_2.6_win64_standalone.exe -f FILENAME imageinfo
vol.py -f "/path/to/file" kdbgscan

img

首先的一个重要参数是Suggested Profile 也就是他的电脑版本号,只有这个版本号才能进行之后的步骤。

例图中的Suggested Profile是有四个信息,但是大概率指向的版本是第一个。

如果Suggested Profile后面带了一个Instantiated with XXXXX就是说他建议是哪个电脑版本号,所以用它建议的就行,当然这个情况也不是全都有的,有时候他不建议,你就选你自己的就行。

下方的Image date and time是这个内存镜像的制作时间,默认是UTC+0的时间,这个参数的下一个Image Local date and time就是我们的UTC+8的时间(即本机的时区)。

进程分析

pslist命令不仅显示了所有正在运行的进程,而且给出了有价值的信息,比如PID、PPID、启动的时间。

pstree与pslist命令不同的地方在于还可以识别子进程以及父进程

psscan命令可以显示出被恶意软件比如rootkit为了躲避用户或杀毒软件而隐藏的进程

psxview查看进程列表(psx视图)

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 pslist

该命令为列出内存中的进程,包括进程PID、PPID以及启动时间,并可以清楚的看到父子进程的关系。

img

如果遇到隐藏的进程,可以使用如下命令

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 psscan

该命令为列出内存中的所有进程,包括进程PID、PPID以及启动时间,并可以清楚的看到父子进程的关系。

img

如果遇到名称伪装的进程,使用如下命令

进程树

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 pstree

img

有些恶意进程会伪装成同名进程,通过进程树,看他不归属于不正常进程

例:很多恶意进程会伪装成svchost.exe,但svchost.exe的真正父进程是services.exe的。

动态链接库

就是所谓的dll文件

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 dlllist

该命令能看到每个进程(程序)运行所需要的所有动态链接库

img

网络连接

1
2
3
4
5
6
7
8
9
10
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 netscan
vol.py -f "/path/to/file" ‑‑profile <profile> netscan
vol.py -f "/path/to/file" ‑‑profile <profile> netstat

# XP/2003 SPECIFIC

vol.py -f "/path/to/file" ‑‑profile <profile> connscan
vol.py -f "/path/to/file" ‑‑profile <profile> connections
vol.py -f "/path/to/file" ‑‑profile <profile> sockscan
vol.py -f "/path/to/file" ‑‑profile <profile> sockets

该命令可查看所有进程的连接协议、本地地址、连接地址、状态、监听端口以及pid。

img

内核驱动

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 modules

该命令查看内核驱动,modscan、driverscan可查看一些隐藏的内核驱动。

提取进程程序

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 procdump -D 路径 -p 进程号PID

注意此命令会自动修改名称,修改后的名称就是图中的 Result的内容

img

内存文件

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 filescan

该命令能扫描内存中的文件

img

导出内存中缓存的文件

1
2
3
4
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 dumpfiles -Q 内存中的位置 -D 导出路径
vol.py -f "/path/to/file" ‑‑profile <profile> dumpfiles ‑‑dump-dir="/path/to/dir"
vol.py -f "/path/to/file" ‑‑profile <profile> dumpfiles ‑‑dump-dir="/path/to/dir" -Q <offset>
vol.py -f "/path/to/file" ‑‑profile <profile> dumpfiles ‑‑dump-dir="/path/to/dir" -p <PID>

该命令能导出内存中缓存的文件

-Q的内容就是filescan中第一行的Offset

img

注册表

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 hivelist

该命令能列举在内存中的注册表

img

cmd命令情况

1
2
3
4
5
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 cmdline

vol.py -f "/path/to/file" ‑‑profile <profile> cmdscan

vol.py -f "/path/to/file" ‑‑profile <profile> consoles

该命令能提取内存中保留的cmd命令使用情况

获取SAM表中的用户

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 printkey -K "SAM\Domprintkeyains\Account\Users\Names"

注意”SAM\Domprintkeyains\Account\Users\Names”这个路径是固定的,不用改变。

最后登录的用户

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 printkey -K "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogin"

该名称能查看最后登录系统的账户

密码hash

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 hashdump -y 注册表 system 的 virtual地址 -s SAM的virtual地址

该命令能从内存中获取密码hash

virtual从hivelist注册表中获得。

img

Windows服务

1
volatility_2.6_win64_standalone.exe -f FILENAME --profile=版本号 svcscan 

该命令能查看Windwos的服务

img

有些服务不一定有进程,所以PID为空。

MFT文件索引

NTFS文件系统是微软自Windows NT系统后引入的全新的文件系统。在NTFS文件系统里,磁盘上的所有东西都以文件的形式保存在NTFS分区内,包括文件系统自身的结构和记录也是如此。NTFS中,卷中所有存放的数据均在一个叫$MFT的文件中,叫主文件表(Master File Table),在MFT中保存了NTFS分区上所有文件的索引,操作系统根据这个索引来检索问价。在使用mftparser插件时发现了flag.zip 和 flag.rar

volatility -f mem.raw --profile=Win7SP1x86 mftparser > mft.txt

内容很多,随查找了一下flag关键字。

所有编辑框中的内容

这里有个更简单的办法,直接用editbox插件,即可看到系统中所有编辑控件中的编辑内容

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
$ volatility2 -f ./mem.raw --profile=Win7SP1x86 editbox
Volatility Foundation Volatility Framework 2.6
******************************
Wnd Context : 1\WinSta0\Default
Process ID : 3640
ImageFileName : iexplore.exe
IsWow64 : No
atom_class : 6.0.7600.16385!Edit
value-of WndExtra : 0x4a13b8
nChars : 0
selStart : 0
selEnd : 0
isPwdControl : False
undoPos : 0
undoLen : 0
address-of undoBuf: 0x0
undoBuf :
-------------------------

******************************
Wnd Context : 1\WinSta0\Default
Process ID : 3640
ImageFileName : iexplore.exe
IsWow64 : No
atom_class : 6.0.7600.16385!Edit
value-of WndExtra : 0x49f3d0
nChars : 60
selStart : 0
selEnd : 0
isPwdControl : False
undoPos : 0
undoLen : 0
address-of undoBuf: 0x0
undoBuf :
-------------------------
https://pan.baidu.com/share/init?surl=jAVwrRzIgW1QsLHidtzY_w
******************************
Wnd Context : 1\WinSta0\Default
Process ID : 3552
ImageFileName : notepad.exe
IsWow64 : No
atom_class : 6.0.7600.16385!Edit
value-of WndExtra : 0x177ad0
nChars : 78
selStart : 0
selEnd : 0
isPwdControl : False
undoPos : 0
undoLen : 0
address-of undoBuf: 0x0
undoBuf :
-------------------------
where is link?链接: https://pan.baidu.com/s/ 提取码: heem 复制这段内容后打开百度网盘手机App,操作更方便哦

两个提取码和提取链接都找到了

插件列表

插件名称 功能 用法
amcache 查看AmCache应用程序痕迹信息
apihooks 检测内核及进程的内存空间中的API hook
atoms 列出会话及窗口站atom表
atomscan Atom表的池扫描(Pool scanner)
auditpol 列出注册表HKLM\SECURITY\Policy\PolAdtEv的审计策略信息
bigpools 使用BigPagePoolScanner转储大分页池(big page pools)
bioskbd 从实时模式内存中读取键盘缓冲数据(早期电脑可以读取出BIOS开机密码)
cachedump 获取内存中缓存的域帐号的密码哈希
callbacks 打印全系统通知例程
clipboard 提取Windows剪贴板中的内容
cmdline 显示进程命令行参数
cmdscan 提取执行的命令行历史记录(扫描_COMMAND_HISTORY信息)
connections 打印系统打开的网络连接(仅支持Windows XP 和2003)
connscan 打印TCP连接信息
consoles 提取执行的命令行历史记录(扫描_CONSOLE_INFORMATION信息)
crashinfo 提取崩溃转储信息
deskscan tagDESKTOP池扫描(Poolscaner)
devicetree 显示设备树信息
dlldump 从进程地址空间转储动态链接库
dlllist 打印每个进程加载的动态链接库列表 Vol.exe -f mem.raw –profile=Win7SP1x86 dlllist
driverirp IRP hook驱动检测
drivermodule 关联驱动对象至内核模块
driverscan 驱动对象池扫描
dumpcerts 提取RAS私钥及SSL公钥
dumpfiles 提取内存中映射或缓存的文件
dumpregistry 转储内存中注册表信息至磁盘 Vol.exe -f mem.raw –profile=Win7SP1x86 dumpregistry
editbox 查看Edit编辑控件信息 (Listbox正在实验中)
envars 显示进程的环境变量
eventhooks 打印Windows事件hook详细信息
evtlogs 提取Windows事件日志(仅支持XP/2003)
filescan 提取文件对象(file objects)池信息
gahti 转储用户句柄(handle)类型信息
gditimers 打印已安装的GDI计时器(timers)及回调(callbacks)
gdt 显示全局描述符表(Global Descriptor Table)
getservicesids 获取注册表中的服务名称并返回SID信息
getsids 打印每个进程的SID信息
handles 打印每个进程打开的句柄的列表(Offset(V), PID, handle, access, type, details) vol.py -f “/path/to/file” ‑‑profile handles -p
hashdump 转储内存中的Windows帐户密码哈希(LM/NTLM) Vol.exe -f mem.raw –profile=Win7SP1x86 hashdump
hibinfo 转储休眠文件信息
hivedump 打印注册表配置单元信息
hivelist 打印注册表配置单元列表
hivescan 注册表配置单元池扫描
hpakextract 从HPAK文件(Fast Dump格式)提取物理内存数据
hpakinfo 查看HPAK文件属性及相关信息
idt 显示中断描述符表(Interrupt Descriptor Table)
iehistory 重建IE缓存及访问历史记录 Vol.exe -f mem.raw –profile=Win7SP1x86 iehistory
imagecopy 将物理地址空间导出原生DD镜像文件
imageinfo 查看/识别镜像信息
impscan 扫描对导入函数的调用
joblinks 打印进程任务链接信息
kdbgscan 搜索和转储潜在KDBG值
kpcrscan 搜索和转储潜在KPCR值
ldrmodules 检测未链接的动态链接DLL
lsadump 从注册表中提取LSA密钥信息(已解密)
machoinfo 转储Mach-O 文件格式信息
malfind 查找隐藏的和插入的代码
mbrparser 扫描并解析潜在的主引导记录(MBR)
memdump 转储进程的可寻址内存
memmap 打印内存映射
messagehooks 桌面和窗口消息钩子的线程列表
mftparser 扫描并解析潜在的MFT条目 Vol.exe -f mem.raw –profile=Win7SP1x86 mftparser –output-file=mftverbose.txt -D mftoutput
moddump 转储内核驱动程序到可执行文件的示例
modscan 内核模块池扫描
modules 打印加载模块的列表
multiscan 批量扫描各种对象
mutantscan 对互斥对象池扫描
notepad 查看记事本当前显示的文本
netscan 查看网络通讯连接 Vol.exe -f mem.raw –profile=Win7SP1x86 netscan
objtypescan 扫描窗口对象类型对象
patcher 基于页面扫描的补丁程序内存
poolpeek 可配置的池扫描器插件
printkey 打印注册表项及其子项和值 vol.py -f “/path/to/file” ‑‑profile printkey -K “Software\Microsoft\Windows\CurrentVersion”
privs 显示进程权限
procdump 进程转储到一个可执行文件示例 vol.py -f “/path/to/file” ‑‑profile procdump -p ‑‑dump-dir=”/path/to/dir”
pslist 按照EPROCESS列表打印所有正在运行的进程 Vol.exe -f mem.raw –profile=Win7SP1x86 pslist
psscan 进程对象池扫描
pstree 以树型方式打印进程列表 Vol.exe -f mem.raw –profile=Win7SP1x86 pstree
psxview 查看进程列表(psx视图) Vol.exe -f mem.raw –profile=Win7SP1x86 psxview
qemuinfo 转储Qemu 信息
raw2dmp 将物理内存原生数据转换为windbg崩溃转储格式
screenshot 基于GDI Windows的虚拟屏幕截图保存
servicediff Windows服务列表(ala Plugx)
sessions _MM_SESSION_SPACE的详细信息列表(用户登录会话)
shellbags 打印Shellbags信息 Vol.exe -f mem.raw –profile=Win7SP1x86 shellbags
shimcache 解析应用程序兼容性Shim缓存注册表项 Vol.exe -f mem.raw –profile=Win7SP1x86 shimcache
shutdowntime 从内存中的注册表信息获取机器关机时间 Vol.exe -f mem.raw –profile=Win7SP1x86 shutdowntime
sockets 打印已打开套接字列表
sockscan TCP套接字对象池扫描
ssdt 显示SSDT条目 Vol.exe -f mem.raw –profile=Win7SP1x86 ssdt
strings 物理到虚拟地址的偏移匹配(需要一些时间,带详细信息)
svcscan Windows服务列表扫描 Vol.exe -f mem.raw –profile=Win7SP1x86 svcscan
symlinkscan 符号链接对象池扫描
thrdscan 线程对象池扫描
threads 调查_ETHREAD 和_KTHREADs
timeliner 创建内存中的各种痕迹信息的时间线
timers 打印内核计时器及关联模块的DPC
truecryptmaster 恢复TrueCrypt 7.1a主密钥 Vol.exe -f mem.raw –profile=Win7SP1x86 truecryptmaster
truecryptpassphrase 查找并提取TrueCrypt密码 Vol.exe -f mem.raw –profile=Win7SP1x86 truecryptpassphrase
truecryptsummary TrueCrypt摘要信息
unloadedmodules 打印卸载的模块信息列表
userassist 打印注册表中UserAssist相关信息 Vol.exe -f mem.raw –profile=Win7SP1x86 userassist
userhandles 转储用户句柄表
vaddump 转储VAD数据为文件
vadinfo 转储VAD信息
vadtree 以树形方式显示VAD树信息
vadwalk 显示遍历VAD树
vboxinfo 转储Virtualbox信息(虚拟机)
verinfo 打印PE镜像中的版本信息
vmwareinfo 转储VMware VMSS/VMSN 信息
volshell 内存镜像中的shell
windows 打印桌面窗口(详细信息)
wintree Z顺序打印桌面窗口树
wndscan 池扫描窗口站
yarascan 以Yara签名扫描进程或内核内存

示例

forensic – RoarCTF

发现是内存取证,使用Volatility内存取证神器。

利用 npm install -g cnpm –registry=https://registry.npm.taobao.org-f mem.raw imageinfo`查看镜像信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
➜  RoarCTF volatility -f mem.raw imageinfo
Volatility Foundation Volatility Framework 2.6
INFO : volatility.debug : Determining profile based on KDBG search...
Suggested Profile(s) : Win7SP1x86_23418, Win7SP0x86, Win7SP1x86_24000, Win7SP1x86
AS Layer1 : IA32PagedMemoryPae (Kernel AS)
AS Layer2 : FileAddressSpace (/media/psf/Home/Documents/CTF-time/RoarCTF/mem.raw)
PAE type : PAE
DTB : 0x185000L
KDBG : 0x81729be8L
Number of Processors : 2
Image Type (Service Pack) : 0
KPCR for CPU 0 : 0x8172ac00L
KPCR for CPU 1 : 0x807ec000L
KUSER_SHARED_DATA : 0xffdf0000L
Image date and time : 2019-09-16 13:55:23 UTC+0000
Image local date and time : 2019-09-16 21:55:23 +0800

根据Suggested Profile(s)值猜测他是Win7SP1x86_23418,所以利用--profile=Win7SP1x86_23418

利用volatility -f mem.raw --profile=Win7SP0x86 psscan查看所有进程,通过所有进程来查看是否有可疑进程出现,进行进一步取证。

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
➜  RoarCTF volatility -f mem.raw --profile=Win7SP0x86 psscan      
Volatility Foundation Volatility Framework 2.6
Offset(P) Name PID PPID PDB Time created Time exited
------------------ ---------------- ------ ------ ---------- ------------------------------ ------------------------------
0x000000001de20d40 svchost.exe 2088 504 0x1ef9b440 2019-09-16 13:53:09 UTC+0000
0x000000001de23cd8 wininit.exe 420 344 0x1ef9b0a0 2019-09-16 13:53:06 UTC+0000
0x000000001de99708 SearchProtocol 2868 2788 0x1ef9b4e0 2019-09-16 13:53:15 UTC+0000
0x000000001e00fd40 svchost.exe 1224 504 0x1ef9b240 2019-09-16 13:53:08 UTC+0000
0x000000001e031ae8 taskhost.exe 1772 504 0x1ef9b2c0 2019-09-16 13:53:08 UTC+0000
0x000000001e074d40 svchost.exe 1372 504 0x1ef9b280 2019-09-16 13:53:08 UTC+0000
0x000000001e0855a0 sppsvc.exe 2720 504 0x1ef9b160 2019-09-16 13:53:14 UTC+0000
0x000000001e0c8d40 taskeng.exe 1512 892 0x1ef9b2e0 2019-09-16 13:53:08 UTC+0000
0x000000001e0da270 dwm.exe 1548 856 0x1ef9b320 2019-09-16 13:53:08 UTC+0000
0x000000001e0fa838 explorer.exe 1636 1528 0x1ef9b340 2019-09-16 13:53:08 UTC+0000
0x000000001e1065c0 imdsksvc.exe 1700 504 0x1ef9b360 2019-09-16 13:53:08 UTC+0000
0x000000001e10f930 coherence.exe 1732 504 0x1ef9b380 2019-09-16 13:53:08 UTC+0000
0x000000001e131d40 prl_tools_serv 1784 504 0x1ef9b3a0 2019-09-16 13:53:08 UTC+0000
0x000000001e14c030 coherence.exe 1864 1732 0x1ef9b3c0 2019-09-16 13:53:08 UTC+0000
0x000000001e158b38 dllhost.exe 1888 504 0x1ef9b3e0 2019-09-16 13:53:09 UTC+0000
0x000000001e17cd40 msdtc.exe 2484 504 0x1ef9b420 2019-09-16 13:53:10 UTC+0000
0x000000001e1e9b38 dllhost.exe 1392 504 0x1ef9b480 2019-09-16 13:53:09 UTC+0000
0x000000001e1fcd40 prl_cc.exe 1980 1896 0x1ef9b4a0 2019-09-16 13:53:09 UTC+0000
0x000000001e1ffd40 VSSVC.exe 296 504 0x1ef9b460 2019-09-16 13:53:09 UTC+0000
0x000000001e228a58 lsm.exe 544 420 0x1ef9b100 2019-09-16 13:53:07 UTC+0000
0x000000001e268520 svchost.exe 644 504 0x1ef9b120 2019-09-16 13:53:07 UTC+0000
0x000000001e33e030 svchost.exe 804 504 0x1ef9b180 2019-09-16 13:53:07 UTC+0000
0x000000001e361938 svchost.exe 856 504 0x1ef9b1a0 2019-09-16 13:53:07 UTC+0000
0x000000001e36b030 svchost.exe 892 504 0x1ef9b1c0 2019-09-16 13:53:07 UTC+0000
0x000000001e383718 audiodg.exe 964 804 0x1ef9b1e0 2019-09-16 13:53:07 UTC+0000
0x000000001e39b8b0 svchost.exe 1036 504 0x1ef9b200 2019-09-16 13:53:07 UTC+0000
0x000000001e3cc728 WUDFHost.exe 1160 856 0x1ef9b220 2019-09-16 13:53:08 UTC+0000
0x000000001e437c38 SearchIndexer. 2788 504 0x1ef9b4c0 2019-09-16 13:53:15 UTC+0000
0x000000001e439a68 svchost.exe 716 504 0x1ef9b140 2019-09-16 13:53:07 UTC+0000
0x000000001e5af8b0 lsass.exe 536 420 0x1ef9b0e0 2019-09-16 13:53:07 UTC+0000
0x000000001ec15d40 smss.exe 272 4 0x1ef9b020 2019-09-16 13:53:04 UTC+0000
0x000000001ec2b030 spoolsv.exe 1340 504 0x1ef9b260 2019-09-16 13:53:08 UTC+0000
0x000000001ec44d40 prl_tools.exe 1896 1784 0x1ef9b400 2019-09-16 13:53:09 UTC+0000
0x000000001ec72bf8 winlogon.exe 492 412 0x1ef9b0c0 2019-09-16 13:53:06 UTC+0000
0x000000001ec98030 svchost.exe 3648 504 0x1ef9b560 2019-09-16 13:53:57 UTC+0000
0x000000001edda270 csrss.exe 428 412 0x1ef9b040 2019-09-16 13:53:06 UTC+0000
0x000000001eddad40 services.exe 504 420 0x1ef9b080 2019-09-16 13:53:06 UTC+0000
0x000000001ef04600 SearchFilterHo 2888 2788 0x1ef9b500 2019-09-16 13:53:15 UTC+0000
0x000000001ef56030 WmiPrvSE.exe 3016 644 0x1ef9b2a0 2019-09-16 13:55:10 UTC+0000
0x000000001ef8dad8 notepad.exe 3524 1636 0x1ef9b300 2019-09-16 13:53:51 UTC+0000
0x000000001ef9f030 TrueCrypt.exe 3260 3072 0x1ef9b580 2019-09-16 13:53:22 UTC+0000
0x000000001efbf6c8 csrss.exe 364 344 0x1ef9b060 2019-09-16 13:53:06 UTC+0000
0x000000001efce468 mspaint.exe 3620 1636 0x1ef9b540 2019-09-16 13:53:57 UTC+0000
0x000000001fc893f0 iexplore.exe 3700 1636 0x1ef9b520 2019-09-16 13:54:03 UTC+0000
0x000000001fcacd40 iexplore.exe 3752 3700 0x1ef9b5a0 2019-09-16 13:54:04 UTC+0000
0x000000001fcff848 conhost.exe 3204 428 0x1ef9b620 2019-09-16 13:55:15 UTC+0000
0x000000001fcffb38 DumpIt.exe 3380 1636 0x1ef9b600 2019-09-16 13:55:15 UTC+0000
0x000000001ffaf950 System 4 0 0x00185000 2019-09-16 13:53:04 UTC+0000

通过观察进程可以看到 DumpIt.exe此项进程,这个便是dump内存时的进程。

进程中有notepad.exe进程PID为 3524 我们提取一下,看看有无线索.

利用 memdump 提取,文件将以进程号命名

1
2
3
4
➜  RoarCTF volatility -f mem.raw --profile=Win7SP0x86 memdump -p 3524 -D ./
Volatility Foundation Volatility Framework 2.6
************************************************************************
Writing notepad.exe [ 3524] to 3524.dmp

查找 notpad 有关flag的

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
➜  RoarCTF strings 3524.dmp| grep flag
flag.txt
M:\flag.txt
flag.zip
M:\flag.zip
flag.txt0
; Hack flag: 00000000.00000800
; Set a hack flag to ignore the boot config for these chipset-integrated bridge.
; Hack flag: 00000000.02000000
; Set a hack flag to force a bridge window alignment to match the length of its
; Hack flag: 00000010.00000000
; Set a hack flag to fail query remove on pci device.
; Hack flag: 00000400.00000000
; Set a hack flag to disable power management downstream of a pci bridge.
; Hack flag: 00000000.00400000
; Set a hack flag to ignore subsystem vendor/device ids.
; Hack flag: 00000200.00000000
; Set a hack flag to enable MSI mapping on memory host controllers.
C:\Users\lethal\Desktop\flag (2).rar
flag.txt0
flag.txt.lnk
flag.zip.lnk
flag (2).rar.lnk
flag.rar.lnk
flag (2).rar.lnk
flag.zip
flag.rar
The Handle property represents a handle to a thread. The handle has full access rights by default. With the correct security access, the handle can be used in any function that accepts a thread handle. Depending on the inheritance flag specified when it is created, this handle can be inherited by child processes.
flag.rar
flag.zip
flag.txt
L:\flag.txt

然后i利用filescan插件查找一下有关flag的文件。

1
2
➜  RoarCTF volatility -f mem.raw --profile=Win7SP0x86 filescan | grep -E 'flag.zip|flag.rar|flag.txt'
Volatility Foundation Volatility Framework 2.6

然后并没有找到,可能是已经被删除了

NTFS文件系统是微软自Windows NT系统后引入的全新的文件系统。在NTFS文件系统里,磁盘上的所有东西都以文件的形式保存在NTFS分区内,包括文件系统自身的结构和记录也是如此。NTFS中,卷中所有存放的数据均在一个叫$MFT的文件中,叫主文件表(Master File Table),在MFT中保存了NTFS分区上所有文件的索引,操作系统根据这个索引来检索问价。在使用mftparser插件时发现了flag.zip 和 flag.rar

volatility -f mem.raw --profile=Win7SP1x86 mftparser > mft.txt

内容很多,随查找了一下flag关键字。

继续查找flag关键字,找到了flag.zip 和 flag.rar 的十六进制 dump 下来

在压缩包里发现了flag.txt,接下来思路是找到 压缩包的密码

首先简单看了下图片。

volatility -f mem.raw --profile=Win7SP1x86 filescan | grep -E "png|jpg|jpeg"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
➜  RoarCTF volatility -f mem.raw --profile=Win7SP0x86 filescan | grep -E 'png|jpg|jpeg'              
Volatility Foundation Volatility Framework 2.6
0x000000001e1a79b8 8 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\W9N0PGR5\Misc_24_af08942[1].png
0x000000001e25b7d8 3 0 R--r-d \Device\HarddiskVolume2\Windows\System32\pngfilt.dll
0x000000001ec601b8 2 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\W9N0PGR5\timer_8dee5c8[1].png
0x000000001efb29f8 8 0 R--r-d \Device\HarddiskVolume2\Users\lethal\Pictures\无标题.png
0x000000001fc87838 8 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\8C65LHWR\youqianhua71090-20190901[1].jpg
0x000000001fc87f80 8 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\W9N0PGR5\vip-icon-all_7d887d5[1].png
0x000000001fc90ad0 2 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\4U3T3ZUT\netdisk.1.b66dd99a.fWIQlbKsyaUNxqaq1TY6xg[1].jpg
0x000000001fc96b00 8 0 R--r-d \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\1C24IFJ8\favicon[1].png
0x000000001fc9ce48 8 0 R--r-d \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\W9N0PGR5\share_tit_bg_5855301[1].png
0x000000001fcbf038 2 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\W9N0PGR5\tip-close_f52b979[1].png
0x000000001fcbfcb0 2 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\8C65LHWR\tips_ffb87d4[1].png
0x000000001fcd8630 8 0 R--r-d \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\W9N0PGR5\ini_logo_ad77277[1].png
0x000000001fcd8d90 2 0 R--r-d \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\4U3T3ZUT\p-vip-icon-all_be8d2cb[1].png
0x000000001fcdb2b0 8 0 R--r-d \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\W9N0PGR5\footer-cloud_0e0a657[1].png
0x000000001fcdbd88 8 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\4U3T3ZUT\Misc_54_f86ddc2[1].png
0x000000001fcfd218 8 0 -W-rwd \Device\HarddiskVolume2\Users\lethal\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5\W9N0PGR5\updata-bg_2be0559[1].png

filesacn发现在我的文档,图片,文件夹里,有张图片 ,dumpfiles 下来就是flag.zip 的密码,成功拿到flag

1
2
3
4
5
6
-Q参数使用物理偏移量进行转储
-n以文件名保存
--dump-dir=目标存储位置
➜ RoarCTF volatility -f mem.raw --profile=Win7SP0x86 dumpfiles -Q 0x000000001efb29f8 -n --dump-dir=./
Volatility Foundation Volatility Framework 2.6
DataSectionObject 0x1efb29f8 None \Device\HarddiskVolume2\Users\lethal\Pictures\无标题.png

[VN2020 公开赛]内存取证

先使用volatility2

查看内存平台版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
λ python2 D:\RayiTools\取证工具\volatility2\vol.py -f .\mem.raw imageinfo
Volatility Foundation Volatility Framework 2.6
INFO : volatility.debug : Determining profile based on KDBG search...
Suggested Profile(s) : Win7SP1x86_23418, Win7SP0x86, Win7SP1x86
AS Layer1 : IA32PagedMemoryPae (Kernel AS)
AS Layer2 : FileAddressSpace (C:\Users\Rayi\Desktop\2020VNCTF\mem.raw)
PAE type : PAE
DTB : 0x185000L
KDBG : 0x8176bbe8L
Number of Processors : 2
Image Type (Service Pack) : 0
KPCR for CPU 0 : 0x8176cc00L
KPCR for CPU 1 : 0x807ec000L
KUSER_SHARED_DATA : 0xffdf0000L
Image date and time : 2020-02-18 19:56:24 UTC+0000
Image local date and time : 2020-02-19 03:56:24 +0800

查看当前进程

1
python2 D:\RayiTools\取证工具\volatility2\vol.py -f .\mem.raw --profile=Win7SP1x86 pstree

pslist命令不仅显示了所有正在运行的进程,而且给出了有价值的信息,比如PID、PPID、启动的时间。

pstree与pslist命令不同的地方在于还可以识别子进程以及父进程

psscan命令可以显示出被恶意软件比如rootkit为了躲避用户或杀毒软件而隐藏的进程

pslist

image-20210508215807909

pstree

image-20210508215825071

psscan

image-20210508215935157

其中有几个值得注意的进程

  • mspaint.exe 微软画图工具
  • notepad.exe 记事本
  • TrueCrypt.exe 加密容器

要导出记事本的内容,可以现将记事本dump出来

1
2
3
4
5
python2 D:\RayiTools\取证工具\volatility2\vol.py -f .\mem.raw --profile=Win7SP1x86 memdump -o 0x000000001f1f5d40 --dump-dir ./

# OR

python2 D:\RayiTools\取证工具\volatility2\vol.py -f .\mem.raw --profile=Win7SP1x86 memdump -p 3552 --dump-dir ./

然后用strings命令导出notepad中的字符串

在一大串字符串中可以找到这些东西

image-20210508220816509

这里有个更简单的办法,直接用editbox插件,即可看到系统中所有编辑控件中的编辑内容

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
$ volatility2 -f ./mem.raw --profile=Win7SP1x86 editbox
Volatility Foundation Volatility Framework 2.6
******************************
Wnd Context : 1\WinSta0\Default
Process ID : 3640
ImageFileName : iexplore.exe
IsWow64 : No
atom_class : 6.0.7600.16385!Edit
value-of WndExtra : 0x4a13b8
nChars : 0
selStart : 0
selEnd : 0
isPwdControl : False
undoPos : 0
undoLen : 0
address-of undoBuf: 0x0
undoBuf :
-------------------------

******************************
Wnd Context : 1\WinSta0\Default
Process ID : 3640
ImageFileName : iexplore.exe
IsWow64 : No
atom_class : 6.0.7600.16385!Edit
value-of WndExtra : 0x49f3d0
nChars : 60
selStart : 0
selEnd : 0
isPwdControl : False
undoPos : 0
undoLen : 0
address-of undoBuf: 0x0
undoBuf :
-------------------------
https://pan.baidu.com/share/init?surl=jAVwrRzIgW1QsLHidtzY_w
******************************
Wnd Context : 1\WinSta0\Default
Process ID : 3552
ImageFileName : notepad.exe
IsWow64 : No
atom_class : 6.0.7600.16385!Edit
value-of WndExtra : 0x177ad0
nChars : 78
selStart : 0
selEnd : 0
isPwdControl : False
undoPos : 0
undoLen : 0
address-of undoBuf: 0x0
undoBuf :
-------------------------
where is link?链接: https://pan.baidu.com/s/ 提取码: heem 复制这段内容后打开百度网盘手机App,操作更方便哦

两个提取码和提取链接都找到了

网盘里存的是VOL加密容器,下一步就是找truecrypt加密容器的解密办法

利用工具Elcomsoft Forensic Disk Decryptor

先dump出内存中的TrueCrypt.exe

然后打开工具

image-20210508223229230

image-20210508223259008

这样就有密钥了

一直下一步,挂载容器

image-20210508223332781

image-20210508223406645

打开里面有个key文件,内容如下

1
uOjFdKu1jsbWI8N51jsbWI8N5

再用这个key去挂载容器

image-20210508223619449

image-20210508223714514