CTF知识树-MISC 内存取证工具volatility的简单应用

视频

简介

Volatility 是一个开源的、跨平台的高级内存取证框架。它专门用于从 RAM(随机存取存储器) 快照(通常称为内存转储)中提取数字证据。

取证的常见文件后缀:.vmem / .dump / .raw / .img

工具介绍

输入vol.py -h查看官方的使用帮助

  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
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
Options:
  -h, --help            list all available options and their default values.
                        Default values may be set in the configuration file
                        (/etc/volatilityrc)
  --conf-file=/home/kali/.volatilityrc
                        User based configuration file
  -d, --debug           Debug volatility
  --plugins=PLUGINS     Additional plugin directories to use (colon separated)
  --info                Print information about all registered objects
  --cache-directory=/home/kali/.cache/volatility
                        Directory where cache files are stored
  --cache               Use caching
  --tz=TZ               Sets the (Olson) timezone for displaying timestamps
                        using pytz (if installed) or tzset
  -f FILENAME, --filename=FILENAME
                        Filename to use when opening an image
  --profile=WinXPSP2x86
                        Name of the profile to load (use --info to see a list
                        of supported profiles)
  -l LOCATION, --location=LOCATION
                        A URN location from which to load an address space
  -w, --write           Enable write support
  --dtb=DTB             DTB Address
  --shift=SHIFT         Mac KASLR shift address
  --output=text         Output in this format (support is module specific, see
                        the Module Output Options below)
  --output-file=OUTPUT_FILE
                        Write output in this file
  -v, --verbose         Verbose information
  --physical_shift=PHYSICAL_SHIFT
                        Linux kernel physical shift address
  --virtual_shift=VIRTUAL_SHIFT
                        Linux kernel virtual shift address
  -g KDBG, --kdbg=KDBG  Specify a KDBG virtual address (Note: for 64-bit
                        Windows 8 and above this is the address of
                        KdCopyDataBlock)
  --force               Force utilization of suspect profile
  --cookie=COOKIE       Specify the address of nt!ObHeaderCookie (valid for
                        Windows 10 only)
  -k KPCR, --kpcr=KPCR  Specify a specific KPCR address

        Supported Plugin Commands:

                amcache         Print AmCache information
                apihooks        Detect API hooks in process and kernel memory
                atoms           Print session and window station atom tables
                atomscan        Pool scanner for atom tables
                auditpol        Prints out the Audit Policies from HKLM\SECURITY\Policy\PolAdtEv
                bigpools        Dump the big page pools using BigPagePoolScanner
                bioskbd         Reads the keyboard buffer from Real Mode memory
                cachedump       Dumps cached domain hashes from memory
                callbacks       Print system-wide notification routines
                clipboard       Extract the contents of the windows clipboard
                cmdline         Display process command-line arguments
                cmdscan         Extract command history by scanning for _COMMAND_HISTORY
                connections     Print list of open connections [Windows XP and 2003 Only]
                connscan        Pool scanner for tcp connections
                consoles        Extract command history by scanning for _CONSOLE_INFORMATION
                crashinfo       Dump crash-dump information
                deskscan        Poolscaner for tagDESKTOP (desktops)
                devicetree      Show device tree
                dlldump         Dump DLLs from a process address space
                dlllist         Print list of loaded dlls for each process
                driverirp       Driver IRP hook detection
                drivermodule    Associate driver objects to kernel modules
                driverscan      Pool scanner for driver objects
                dumpcerts       Dump RSA private and public SSL keys
                dumpfiles       Extract memory mapped and cached files
                dumpregistry    Dumps registry files out to disk 
                editbox         Displays information about Edit controls. (Listbox experimental.)
                envars          Display process environment variables
                eventhooks      Print details on windows event hooks
                evtlogs         Extract Windows Event Logs (XP/2003 only)
                filescan        Pool scanner for file objects
                gahti           Dump the USER handle type information
                gditimers       Print installed GDI timers and callbacks
                gdt             Display Global Descriptor Table
                getservicesids  Get the names of services in the Registry and return Calculated SID
                getsids         Print the SIDs owning each process
                handles         Print list of open handles for each process
                hashdump        Dumps passwords hashes (LM/NTLM) from memory
                hibinfo         Dump hibernation file information
                hivedump        Prints out a hive
                hivelist        Print list of registry hives.
                hivescan        Pool scanner for registry hives
                hpakextract     Extract physical memory from an HPAK file
                hpakinfo        Info on an HPAK file
                idt             Display Interrupt Descriptor Table
                iehistory       Reconstruct Internet Explorer cache / history
                imagecopy       Copies a physical address space out as a raw DD image
                imageinfo       Identify information for the image 
                impscan         Scan for calls to imported functions
                joblinks        Print process job link information
                kdbgscan        Search for and dump potential KDBG values
                kpcrscan        Search for and dump potential KPCR values
                ldrmodules      Detect unlinked DLLs
                lsadump         Dump (decrypted) LSA secrets from the registry
                machoinfo       Dump Mach-O file format information
                malfind         Find hidden and injected code
                mbrparser       Scans for and parses potential Master Boot Records (MBRs) 
                memdump         Dump the addressable memory for a process
                memmap          Print the memory map
                messagehooks    List desktop and thread window message hooks
                mftparser       Scans for and parses potential MFT entries 
                moddump         Dump a kernel driver to an executable file sample
                modscan         Pool scanner for kernel modules
                modules         Print list of loaded modules
                multiscan       Scan for various objects at once
                mutantscan      Pool scanner for mutex objects
                notepad         List currently displayed notepad text
                objtypescan     Scan for Windows object type objects
                patcher         Patches memory based on page scans
                poolpeek        Configurable pool scanner plugin
                printkey        Print a registry key, and its subkeys and values
                privs           Display process privileges
                procdump        Dump a process to an executable file sample
                pslist          Print all running processes by following the EPROCESS lists 
                psscan          Pool scanner for process objects
                pstree          Print process list as a tree
                psxview         Find hidden processes with various process listings
                qemuinfo        Dump Qemu information
                raw2dmp         Converts a physical memory sample to a windbg crash dump
                screenshot      Save a pseudo-screenshot based on GDI windows
                servicediff     List Windows services (ala Plugx)
                sessions        List details on _MM_SESSION_SPACE (user logon sessions)
                shellbags       Prints ShellBags info
                shimcache       Parses the Application Compatibility Shim Cache registry key
                shutdowntime    Print ShutdownTime of machine from registry
                sockets         Print list of open sockets
                sockscan        Pool scanner for tcp socket objects
                ssdt            Display SSDT entries
                strings         Match physical offsets to virtual addresses (may take a while, VERY verbose)
                svcscan         Scan for Windows services
                symlinkscan     Pool scanner for symlink objects
                thrdscan        Pool scanner for thread objects
                threads         Investigate _ETHREAD and _KTHREADs
                timeliner       Creates a timeline from various artifacts in memory 
                timers          Print kernel timers and associated module DPCs
                truecryptmaster Recover TrueCrypt 7.1a Master Keys
                truecryptpassphrase     TrueCrypt Cached Passphrase Finder
                truecryptsummary        TrueCrypt Summary
                unloadedmodules Print list of unloaded modules
                userassist      Print userassist registry keys and information
                userhandles     Dump the USER handle tables
                vaddump         Dumps out the vad sections to a file
                vadinfo         Dump the VAD info
                vadtree         Walk the VAD tree and display in tree format
                vadwalk         Walk the VAD tree
                vboxinfo        Dump virtualbox information
                verinfo         Prints out the version information from PE images
                vmwareinfo      Dump VMware VMSS/VMSN information
                volshell        Shell in the memory image
                windows         Print Desktop Windows (verbose details)
                wintree         Print Z-Order Desktop Windows Tree
                wndscan         Pool scanner for window stations
                yarascan        Scan process or kernel memory with Yara signatures
  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
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
选项:
- `-h, --help`:列出所有可用选项及其默认值。默认值可以在配置文件中设置(`/etc/volatilityrc`)。
- `--conf-file=/home/kali/.volatilityrc`:用户配置文件。
- `-d, --debug`:调试 Volatility。
- `--plugins=PLUGINS`:使用额外的插件目录(用冒号分隔)。
- `--info`:打印所有已注册对象的信息。
- `--cache-directory=/home/kali/.cache/volatility`:缓存文件存储的目录。
- `--cache`:使用缓存。
- `--tz=TZ`:设置显示时间戳的(Olson)时区,使用 pytz(如果已安装)或 tzset。
- `-f FILENAME, --filename=FILENAME`:打开镜像时使用的文件名。
- `--profile=WinXPSP2x86`:要加载的配置文件名称(使用 `--info` 查看支持的配置文件列表)。
- `-l LOCATION, --location=LOCATION`:加载地址空间的 URN 位置。
- `-w, --write`:启用写支持。
- `--dtb=DTB`:DTB 地址。
- `--shift=SHIFT`:Mac KASLR 移动地址。
- `--output=text`:以这种格式输出(支持取决于模块,详见下面的模块输出选项)。
- `--output-file=OUTPUT_FILE`:将输出写入此文件。
- `-v, --verbose`:详细信息。
- `--physical_shift=PHYSICAL_SHIFT`:Linux 内核物理移动地址。
- `--virtual_shift=VIRTUAL_SHIFT`:Linux 内核虚拟移动地址。
- `-g KDBG, --kdbg=KDBG`:指定 KDBG 虚拟地址(注意:对于 64 位 Windows 8 及以上版本,这是 KdCopyDataBlock 的地址)。
- `--force`:强制使用可疑的配置文件。
- `--cookie=COOKIE`:指定 nt!ObHeaderCookie 的地址(仅适用于 Windows 10)。
- `-k KPCR, --kpcr=KPCR`:指定特定的 KPCR 地址。

**支持的插件命令:**

- `amcache`:打印 AmCache 信息。
- `apihooks`:检测进程和内核内存中的 API 钩子。
- `atoms`:打印会话和窗口站的原子表。
- `atomscan`:原子表的池扫描器。
- `auditpol`:打印注册表中 HKLM\SECURITY\Policy\PolAdtEv 的审核策略。
- `bigpools`:使用 BigPagePoolScanner 转储大页面池。
- `bioskbd`:从实模式内存中读取键盘缓冲区。
- `cachedump`:从内存中转储缓存的域哈希。
- `callbacks`:打印系统范围的通知例程。
- `clipboard`:提取 Windows 剪贴板的内容。
- `cmdline`:显示进程命令行参数。
- `cmdscan`:通过扫描 `_COMMAND_HISTORY` 提取命令历史。
- `connections`:打印开放连接列表(仅限 Windows XP 和 2003)。
- `connscan`:TCP 连接的池扫描器。
- `consoles`:通过扫描 `_CONSOLE_INFORMATION` 提取命令历史。
- `crashinfo`:转储崩溃转储信息。
- `deskscan``tagDESKTOP`(桌面)的池扫描器。
- `devicetree`:显示设备树。
- `dlldump`:从进程地址空间转储 DLL。
- `dlllist`:打印每个进程加载的 DLL 列表。
- `driverirp`:检测驱动程序 IRP 钩子。
- `drivermodule`:将驱动对象与内核模块关联。
- `driverscan`:驱动对象的池扫描器。
- `dumpcerts`:转储 RSA 私钥和公钥 SSL 密钥。
- `dumpfiles`:提取内存映射和缓存的文件。
- `dumpregistry`:将注册表文件转储到磁盘。
- `editbox`:显示有关编辑控件的信息(列表框为实验性)。
- `envars`:显示进程环境变量。
- `eventhooks`:打印 Windows 事件钩子的详细信息。
- `evtlogs`:提取 Windows 事件日志(仅限 XP/2003)。
- `filescan`:文件对象的池扫描器。
- `gahti`:转储 USER 句柄类型信息。
- `gditimers`:打印安装的 GDI 定时器和回调。
- `gdt`:显示全局描述符表。
- `getservicesids`:获取注册表中服务的名称并返回计算出的 SID。
- `getsids`:打印拥有每个进程的 SID。
- `handles`:打印每个进程打开的句柄列表。
- `hashdump`:从内存中转储密码哈希(LM/NTLM)。
- `hibinfo`:转储休眠文件信息。
- `hivedump`:打印注册表项。
- `hivelist`:打印注册表项列表。
- `hivescan`:注册表项的池扫描器。
- `hpakextract`:从 HPAK 文件中提取物理内存。
- `hpakinfo`:显示 HPAK 文件的信息。
- `idt`:显示中断描述符表。
- `iehistory`:重建 Internet Explorer 缓存/历史记录。
- `imagecopy`:将物理地址空间作为原始 DD 镜像复制出来。
- `imageinfo`:识别镜像的信息。
- `impscan`:扫描对导入函数的调用。
- `joblinks`:打印进程作业链接信息。
- `kdbgscan`:搜索并转储潜在的 KDBG 值。
- `kpcrscan`:搜索并转储潜在的 KPCR 值。
- `ldrmodules`:检测未链接的 DLL。
- `lsadump`:从注册表中转储(解密的)LSA 密钥。
- `machoinfo`:转储 Mach-O 文件格式信息。
- `malfind`:查找隐藏和注入的代码。
- `mbrparser`:扫描并解析潜在的主引导记录(MBR)。
- `memdump`:转储进程的可寻址内存。
- `memmap`:打印内存映射。
- `messagehooks`:列出桌面和线程窗口消息钩子。
- `mftparser`:扫描并解析潜在的 MFT 条目。
- `moddump`:将内核驱动程序转储为可执行文件样本。
- `modscan`:内核模块的池扫描器。
- `modules`:打印已加载模块的列表。
- `multiscan`:一次性扫描各种对象。
- `mutantscan`:互斥对象的池扫描器。
- `notepad`:列出当前显示的记事本文本。
- `objtypescan`:扫描 Windows 对象类型对象。
- `patcher`:基于页面扫描对内存进行修补。
- `poolpeek`:可配置的池扫描器插件。
- `printkey`:打印注册表项及其子项和值。
- `privs`:显示进程权限。
- `procdump`:将进程转储为可执行文件样本。
- `pslist`:通过跟踪 EPROCESS 列表打印所有运行的进程。
- `psscan`:进程对象的池扫描器。
- `pstree`:以树形方式打印进程列表。
- `psxview`:使用各种进程列表查找隐藏进程。
- `qemuinfo`:转储 Qemu 信息。
- `raw2dmp`:将物理内存样本转换为 WinDbg 崩溃转储。
- `screenshot`:基于 GDI 窗口保存伪截图。
- `servicediff`:列出 Windows 服务(类似 Plugx)。
- `sessions`:列出 `_MM_SESSION_SPACE`(用户登录会话)的详细信息。
- `shellbags`:打印 ShellBags 信息。
- `shimcache`:解析应用程序兼容性 Shim 缓存注册表项。
- `shutdowntime`:从注册表打印机器的关机时间。
- `sockets`:打印开放套接字列表。
- `sockscan`:TCP 套接字对象的池扫描器。
- `ssdt`:显示 SSDT 条目。
- `strings`:将物理偏移量匹配到虚拟地址(可能需要一些时间,非常详细)。
- `svcscan`:扫描 Windows 服务。
- `symlinkscan`:符号链接对象的池扫描器。
- `thrdscan`:线程对象的池扫描器。
- `threads`:调查 `_ETHREAD``_KTHREAD`- `timeliner`:从内存中的各种工件创建时间线。
- `timers`:打印内核定时器及其关联模块的 DPC。
- `truecryptmaster`:恢复 TrueCrypt 7.1a 主密钥。
- `truecryptpassphrase`:查找 TrueCrypt 缓存的密码短语。
- `truecryptsummary`:TrueCrypt 摘要。
- `unloadedmodules`:打印已卸载模块的列表。
- `userassist`:打印用户协助注册表项和信息。
- `userhandles`:转储 USER 句柄表。
- `vaddump`:将 VAD 部分转储到文件中。
- `vadinfo`:转储 VAD 信息。
- `vadtree`:以树形格式遍历 VAD 树并显示。
- `vadwalk`:遍历 VAD 树。
- `vboxinfo`:转储 VirtualBox 信息。
- `verinfo`:从 PE 镜像打印版本信息。
- `vmwareinfo`:转储 VMware VMSS/VMSN 信息。
- `volshell`:在内存镜像中打开 shell。
- `windows`:打印桌面窗口(详细信息)。
- `wintree`:打印 Z-Order 桌面窗口树。
- `wndscan`:窗口站的池扫描器。
- `yarascan`:使用 Yara 签名扫描进程或内核内存。

vol.py –info可查看插件

确定操作系统

1
vol.py -f 文件 --profile=操作系统

在分析之前,需要先判断当前的镜像信息,分析出是哪个操作系统

1
vol.py -f 文件 imageinfo

在查到操作系统后如果不确定可以使用以下命令查看

1
vol.py -f 文件 --profile=操作系统 volshell

例子:[HDCTF2019]你能发现什么蛛丝马迹吗

当我们确定操作系统就可以利用插件去做题了

常用命令插件

  • 查看当前内存镜像中的用户printkey -K “SAM\Domains\Account\Users\Names”
1
vol.py -f 文件 –profile=操作系统 printkey -K “SAM\Domains\Account\Users\Names”
  • 查看用户名密码信息(密码是哈希值,需要john爆破)hashdump
1
vol.py -f 文件 --profile=操作系统 hashdump
  • 如果john爆破不出来,就使用lasdmp查看强密码lsadmp
1
vol.py -f 文件 --profile=操作系统 lsadump
  • 查看进程pslist
1
vol.py -f 文件 --profile=操作系统 pslist

注意:pslist该插件列举出系统进程,但它不能检测到隐藏或者解链的进程,psscan可以

  • 查看已知进程pslist
1
vol.py -f 文件 --profile=操作系统 pslist -p 进程号

字段说明:

Offset(V): 进程的虚拟地址偏移量。 Name: 进程的名称(如 smss.exe)。 PID: 进程的唯一标识符。 PPID: 进程的父进程 ID。 Thds: 进程包含的线程数。 Hnds: 进程打开的句柄数。 Sess: 会话 ID,用于区分用户登录会话(特别是在多用户系统中)。 Wow64: 如果进程运行在 64 位系统的 32 位兼容模式下,则显示为 True,否则为空。 Start: 进程的启动时间。 Exit: 进程的退出时间。如果为空,表示进程当前正在运行。

  • 隐藏或解链的进程psscan
1
vol.py -f 文件 --profile=操作系统 psscan
  • 查看服务查询服务名称svcscan
1
vol.py -f 文件 --profile=操作系统 svcscan

svcscan:扫描 Windows 的服务

  • 查看浏览器历史记录,获取当前系统浏览器搜索过的关键词iehistory
1
vol.py -f 文件 --profile=操作系统 iehistory
  • 查看网络连接获取当前系统ip netscan
1
vol.py -f 文件 --profile=操作系统 netscan

有些版本使用不了,netscan可以换为命令connscan,connections

  • 查看命令行操作,显示cmd历史命令cmdscan
1
vol.py -f 文件 --profile=操作系统 cmdscan
  • 查看进程命令行参数(具体一些可疑进程的参数指令)cmdline
1
vol.py -f 文件 --profile=操作系统 cmdline
  • 扫描所有的文件列表filescan
1
vol.py -f 文件 --profile=操作系统 filescan

linux配合 grep 命令进行相关字符定向扫描

  • 查看文件内容dumpfiles
1
vol.py -f 文件 --profile=操作系统 dumpfiles -Q 0xxxxxxxx -D ./

需要指定偏移量 -Q 和输出目录 -D

dumpfiles:导出某一文件(指定虚拟地址)

  • 查看当前展示的notepad内容notepad
1
vol.py -f 文件 --profile=操作系统 notepad
  • 提取进程memdump
1
vol.py -f 文件 --profile=操作系统 memdump -p xxx --dump-dir=./

memdump:提取出指定进程,常用foremost 来分离里面的文件

需要指定进程-p [pid]

学习链接

https://blog.csdn.net/m0_68012373/article/details/127419463

使用 Hugo 构建
主题 StackJimmy 设计