持续创作,加速成长!这是我参与「掘金日新计划 · 6 月更文挑战」的第8天,点击查看活动详情
简单写一下这个工具最基本的使用
内存取证,是指利用将内存进程写入镜像文件,通过镜像文件查看之前内存进程的一些信息。
这里主要使用工具——volatility
volatility是一款开源的内存取证分析工具,由python编写,支持各种操作系统。可以通过插件来拓展功能。kali下集成了该工具,命令行输入volatility使用该工具
常用命令
volatility -f imageinfo +文件名 用imageinfo插件得到一些profile类型 的基本信息。
volatility -f +文件名 pslist --profile=系统 再查看进程信息
volatility -f +文件名 pslist --profile= 系统 |grep notepad 搜索指定的指定插件notepad。
volatility notepad -f +文件 pslist --profile=系统 用notepad插件读取出里面的内容
cmdline/cmdscan 列出历史cmd命令
filescan 扫描文件,可配合grep使用
pslist/psscan 列出进程列表
netscan 扫描建立的连接和套接字,类似于netstat
svcscan 扫描windows服务列表
screenshot 显示GDI样式的截屏
memdump 从内存dump进程的内存
dumpfiles 从内存dump文件
Dumpregistry 提取日志文件
Dlllist 显示每个进程的加载dll列表
查看用户名密码信息
volatility -f 1.vmem --profile=Win7SP1x64 hashdump
1
查看进程
volatility -f 1.vmem --profile=Win7SP1x64 pslist
1
查看服务
volatility -f 1.vmem --profile=Win7SP1x64 svcscan
1
查看浏览器历史记录
volatility -f 1.vmem --profile=Win7SP1x64 iehistory
1
查看网络连接
volatility -f 1.vmem --profile=Win7SP1x64 netscan
1
查看命令行操作
volatility -f 1.vmem --profile=Win7SP1x64 cmdscan
1
查看文件
volatility -f 1.vmem --profile=Win7SP1x64 filescan
1
查看文件内容
volatility -f 1.vmem --profile=Win7SP1x64 dumpfiles -Q 0xxxxxxxx -D ./
1
查看当前展示的notepad内容
volatility -f 1.vmem --profile=Win7SP1x64 notepad
1
提取进程
volatility -f 1.vmem --profile=Win7SP1x64 memdump -p xxx --dump-dir=./
1
屏幕截图
volatility -f 1.vmem --profile=Win7SP1x64 screenshot --dump-dir=./
1
查看注册表配置单元
volatility -f 1.vmem --profile=Win7SP1x64 hivelist
1
查看注册表键名
volatility -f 1.vmem --profile=Win7SP1x64 hivedump -o 0xfffff8a001032410
1
查看注册表键值
volatility -f 1.vmem --profile=Win7SP1x64 printkey -K "xxxxxxx"
1
查看运行程序相关的记录,比如最后一次更新时间,运行过的次数等。
volatility -f 1.vmem --profile=Win7SP1x64 userassist
1
最大程序提取信息
volatility -f 1.vmem --profile=Win7SP1x64 timeliner
在分析之前,需要先判断当前的镜像信息,分析出是哪个操作系统
volatility -f xxx.vmem imageinfo
取证举例
e.g.给你一个.vmem文件,让你获取admin密码
step1:先通过imageinfo获取系统信息
step2:使用hashdump获取sam
step3:可以通过john工具来进行爆破 |使用了lasdump命令来查看
e.g2:获取ip地址
step:通过netscan可以查询到地址
step2:主机名需要通过查询注册表,先用hivelist
step3:通过hivedump查询对应键名
e.g3:获取桌面上的 flag.txt中的文件内容是什么
step1:先用filescan扫描文件
step2:接着使用dumpfiles爆破文件内容
step3:然后文件内容即可看到结果
e.g4:服务器中存在一个挖矿病毒 矿池地址是?
step1:查看netscan的内容,惟一一个建立了连接的就是矿池地址
通过以上内容,了解到了该工具的简单用法
插件&参数
volatility 使用:
volatility -f <文件名> -–profile=<配置文件> <插件> [插件参数]
通过volatility --info获取工具所支持的profile,Address Spaces,Scanner Checks,Plugins
常用插件:
imageinfo:找系统
pslist:该插件列举出系统进程,但它不能检测到隐藏或者解链的进程,psscan可以
psscan:可以找到先前已终止(不活动)的进程以及被rootkit隐藏或解链的进程
pstree:以树的形式查看进程列表,和pslist一样,也无法检测隐藏或解链的进程
mendump:提取出指定进程,常用foremost 来分离里面的文件
filescan:扫描所有的文件列表
hashdump:获取sam
svcscan:扫描 Windows 的服务
connscan:查看网络连接
百度找到了所有的参数,列一个表
Supported Plugin Commands:
amcache Print AmCache information //打印AmCache信息
apihooks Detect API hooks in process and kernel memory //检测进程和内核内存中的API挂钩
atoms Print session and window station atom tables //打印会话和窗口站atom表
atomscan Pool scanner for atom tables //用于atom表的池扫描程序
auditpol Prints out the Audit Policies from HKLM\SECURITY\Policy\PolAdtEv //auditpol从HKLM \ SECURITY \ Policy \ PolAdtEv中打印出审核策略
bigpools Dump the big page pools using BigPagePoolScanner // bigpools使用BigPagePoolScanner转储大页面池
bioskbd Reads the keyboard buffer from Real Mode memory // bioskbd从实模式内存中读取键盘缓冲区
cachedump Dumps cached domain hashes from memory //从内存中转储缓存的域哈希
callbacks Print system-wide notification routines //回调打印系统范围的通知例程
clipboard Extract the contents of the windows clipboard //剪贴板提取Windows剪贴板的内容
cmdline Display process command-line arguments //显示进程命令行参数
cmdscan Extract command history by scanning for _COMMAND_HISTORY //通过扫描_COMMAND_HISTORY提取命令历史记录
connections Print list of open connections [Windows XP and 2003 Only] //列印已开启的连接[只适用于windowsxp及2003]
connscan Pool scanner for tcp connections //用于tcp连接的池扫描程序
consoles Extract command history by scanning for _CONSOLE_INFORMATION 通过扫描_CONSOLE_INFORMATION提取命令历史记录
crashinfo Dump crash-dump information //转储崩溃转储信息
deskscan Poolscaner for tagDESKTOP (desktops) //用于tagDESKTOP的Poolscaner(桌面)
devicetree Show device tree //显示设备树
dlldump Dump DLLs from a process address space //从进程地址空间中转储DLL
dlllist Print list of loaded dlls for each process //打印每个进程已加载的dll的列表
driverirp Driver IRP hook detection //驱动程序IRP挂钩检测
drivermodule Associate driver objects to kernel modules //将驱动程序对象与内核模块相关联
driverscan Pool scanner for driver objects //池扫描程序中的驱动程序对象
dumpcerts Dump RSA private and public SSL keys //转储RSA专用和公用SSL密钥
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 //在Windows事件挂钩上打印详细信息
evtlogs Extract Windows Event Logs (XP/2003 only) //提取Windows事件日志(仅适用于XP / 2003)
filescan Pool scanner for file objects //池扫描程序中的文件对象
gahti Dump the USER handle type information //转储USER句柄类型信息 gditimers Print installed GDI timers and callbacks //打印已安装的GDI计时器和回调
gdt Display Global Descriptor Table //显示全局描述符表
getservicesids Get the names of services in the Registry and return Calculated SID //获取注册表中的服务名称,并返回计算出的SID
getsids Print the SIDs owning each process //打印拥有每个进程的SID
handles Print list of open handles for each process //打印每个进程的打开句柄列表
hashdump Dumps passwords hashes (LM/NTLM) from memory //从内存中转储密码散列(LM/NTLM
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 //从HPAK文件提取物理内存
hpakinfo Info on an HPAK file //有关HPAK文件的信息
idt Display Interrupt Descriptor Table //显示中断描述符表
iehistory Reconstruct Internet Explorer cache / history //重建Internet Explorer缓存/历史记录
imagecopy Copies a physical address space out as a raw DD image //将物理地址空间复制为原始DD图像
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 //搜索并转储潜在的KDBG值
kpcrscan Search for and dump potential KPCR values //搜索和转储潜在的KPCR值
ldrmodules Detect unlinked DLLs //检测链接dll
lsadump Dump (decrypted) LSA secrets from the registry //从注册表转储(解密的)LSA机密
machoinfo Dump Mach-O file format information //转储Mach-O文件格式信息
malfind Find hidden and injected code //找到隐藏的和注入的代码
mbrparser Scans for and parses potential Master Boot Records (MBRs) //扫描和解析潜在主引导记录(mbr)
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 //扫描和解析潜在的MFT条目
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 //扫描Windows对象类型的对象
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 //按照EPROCESS列表打印所有正在运行的进程
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 //转储Qemu信息
raw2dmp Converts a physical memory sample to a windbg crash dump //将物理内存示例转换为windbg崩溃转储
screenshot Save a pseudo-screenshot based on GDI windows //保存一个基于GDI窗口的伪截图
servicediff List Windows services (ala Plugx) //列出Windows服务(ala Plugx)
sessions List details on _MM_SESSION_SPACE (user logon sessions) //列出关于_MM_SESSION_SPACE(用户登录会话)的详细信息
shellbags Prints ShellBags info //打印ShellBags信息
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 //用于tcp套接字对象的池扫描程序
ssdt Display SSDT entries //SSDT条目显示
strings Match physical offsets to virtual addresses (may take a while, VERY verbose) //将物理偏移量匹配到虚拟地址(可能需要一段时间,非常冗长)
svcscan Scan for Windows services //扫描Windows服务
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 //打印内核计时器和相关模块DPCs
truecryptmaster Recover TrueCrypt 7.1a Master Keys //恢复TrueCrypt 7.1a主密钥
truecryptpassphrase TrueCrypt Cached Passphrase Finder //TrueCrypt缓存了密码短语查找器
truecryptsummary TrueCrypt Summary //TrueCrypt总结
unloadedmodules Print list of unloaded modules //打印已卸载模块列表
userassist Print userassist registry keys and information //打印userassist注册表项和信息
userhandles Dump the USER handle tables //转储用户句柄表
vaddump Dumps out the vad sections to a file //将vad节转储到一个文件中
vadinfo Dump the VAD info //转储VAD信息
vadtree Walk the VAD tree and display in tree format //遍历VAD树并以树格式显示
vadwalk Walk the VAD tree //走在树下
vboxinfo Dump virtualbox information //转储virtualbox信息
verinfo Prints out the version information from PE images //从PE图像打印出版本信息
vmwareinfo Dump VMware VMSS/VMSN information //转储VMware VMSS/VMSN信息
volshell Shell in the memory image //贝壳在记忆中的形象
windows Print Desktop Windows (verbose details) //打印桌面窗口(详细信息)
wintree Print Z-Order Desktop Windows Tree //打印z顺序桌面Windows树
wndscan Pool scanner for window stations //池扫描窗口站
yarascan Scan process or kernel memory with Yara signatures //用Yara签名扫描进程或内核内存
Linux
linux_apihooks - 检查用户名apihooks
linux_arp - 打印ARP表
linux_aslr_shift - 自动检测Linux aslr改变
linux_banner - 打印Linux Banner信息
linux_bash - 从bash进程内存中恢复bash历史记录
linux_bash_env - 恢复一个进程的动态环境变量
linux_bash_hash - 从bash进程内存中恢复bash哈希表
linux_check_afinfo - 验证网络协议的操作函数指针
linux_check_creds - 检查是否有任何进程正在共享凭证结构
linux_check_evt_arm - 检查异常向量表以查找系统调用表钩子
linux_check_fop - 检查rootkit修改的文件操作结构
linux_check_idt - 检查IDT是否被更改
linux_check_inline_kernel - 检查内联内核挂钩
linux_check_modules - 将模块列表与sysfs信息进行比较
linux_check_syscall - 检查系统调用表是否已被更改
linux_check_tty - 检查tty的钩子
linux_cpuinfo - 打印有关每个活动处理器的信息
linux_dentry_cache - 从dentry缓存收集文件
linux_dmesg - 收集dmesg buffer
linux_dump_map - 将选定的内存映射写入到磁盘
linux_dynamic_env - 恢复进程的动态环境变量
linux_elfs - 在进程映射中找ELF二进制文件
linux_enumerate_files - 列出文件系统缓存引用的文件
linux_find_file - 列出并从内存中恢复文件
linux_getcwd - 列出每个进程的当前工作目录
linux_hidden_modules - Carves内存寻找隐藏的内核模块
linux_ifconfig - 收集活动接口
linux_info_regs - GDB中的“info寄存器”。它打印出所有的输出
linux_iomem - 提供与/proc/iomem相似的输出
linux_kernel_opened_files - 列出从内核中打开的文件
linux_keyboard_notifiers - 解析键盘通知调用链
linux_ldrmodules - 将proc映射的输出与libdl中的库列表进行比较
linux_library_list - 将库加载到一个进程中
linux_librarydump - 将进程内存中的共享库转储到磁盘
linux_list_raw - 列出应用程序与混杂的套接字
linux_lsmod - 收集加载内核模块
linux_lsof - 列出文件描述符及其路径
linux_malfind - 查找可疑的过程映射
linux_memmap - 转储用于linux任务的内存映射
linux_moddump - 提取加载内核模块
linux_mount - 收集挂载的fs/devices
linux_mount_cache - 收集从kmem_cache安装的fs/设备。
linux_netfilter - 列出Netfilter钩子
linux_netscan - 刻画网络连接结构
linux_netstat - 列表打开的套接字
linux_pidhashtable - 通过PID哈希表枚举进程
linux_pkt_queues - 将每个进程的数据包队列写入磁盘
linux_plthook - 扫描ELF二进制文件' PLT hooks
linux_proc_maps - 收集进程内存映射
linux_proc_maps_rb - 通过映射红黑树收集linux的进程映射
linux_procdump - 将进程的可执行映像转储到磁盘
linux_process_hollow - 检查是否有进程被挖空的迹象
linux_psaux - 收集进程和完整的命令行和开始时间
linux_psenv - 收集进程及其静态环境变量
linux_pslist - 收集活动任务通过task_struct->task list
linux_pslist_cache - 从kmem_cache中收集计划任务
linux_psscan - 扫描进程的物理内存
linux_pstree - 显示进程之间的父/子关系
linux_psxview - 查找隐藏进程与各种各样的进程列表
linux_recover_filesystem - 从内存中恢复整个缓存的文件系统
linux_route_cache - 从内存中恢复路由缓存
linux_sk_buff_cache - 从sk_buff kmem_cache中恢复数据包
linux_slabinfo - 在一台正在运行的机器上模拟/proc/slabinfo。
linux_strings - 将物理偏移量匹配到虚拟地址(可能需要一段时间,非常详细)
linux_threads - 打印进程的线程
linux_tmpfs - 从内存中恢复tmpfs文件系统。
linux_truecrypt_passphrase - 恢复缓存Truecrypt口令
linux_vma_cache - 从vm_area_struct 缓存中收集VMAs
linux_volshell - 内存映像中的shell
linux_yarascan - Linux内存映像中的一个shell
CTF中简单使用
由上面可见,参数实在是太多了,我着重看了下在比赛中的用法
相当于给出镜像文件,一般为.raw文件,在这些文件中找出相应的文件
查看系统信息
volatility -f mem.raw imageinfo
查看运行程序列表
volatility -f mem.raw --profile=Win7SP1x64 pslist
查看文件
volatility -f mem.raw --profile=Win7SP1x64 filescan
一般文件会很多,不易查看,用grep命令过滤、//分离txt文件
volatility -f mem.raw --profile=Win7SP1x64 filescan |grep txt
提取文件
volatility -f mem.raw --profile=Win7SP1x64 dumpfiles -Q 0x000000001e7c3420 -D aaa
-Q是偏移量,-D是存储的文件夹
查看cmd下执行的文件
volatility -f mem.raw --profile=Win7SP1x64 cmdscan
离出cmd下执行的某个文件
volatility -f mem.raw --profile=Win7SP1x64 memdump -p 2884 -D aaa
-p是进程号,flag的文件在进程号为2884,分离出的文件为流量包
提取账户密码
volatility -f mem.raw --profile=Win7SP0x64 hashpump
查看网络连接
volatility -f mem.raw --profile=Win7SP1x64 netscan
查看已经建立的网络连接
volatility -f mem.raw --profile=Win7SP1x64 netscan|grep ESTABLISHED