利用Volatility进行入侵痕迹分析
字数 1525 2025-08-20 18:17:42

利用Volatility进行入侵痕迹分析 - 完整教学指南

0x00 环境准备

工具准备:

  • Volatility:Kali Linux 2自带版本2.4,建议使用最新版本2.6
  • 下载地址:https://github.com/volatilityfoundation/volatility
  • Windows内存镜像工具:DumpIt等

系统要求:

  • 本文以Windows系统内存镜像为例进行分析
  • 示例镜像:PC-20170527XAOD-20180409-232828.raw
  • 示例系统配置:Win7SP1x86

0x01 网络连接分析

命令:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 netscan

功能:

  • 查看系统网络连接情况
  • 识别异常连接和远程IP

0x02 进程分析

基本进程查看:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 pslist

隐藏进程检测:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 psxview

关键点:

  • psxview可以检测通过DKOM等技术隐藏的进程
  • 对比pslist和psxview结果寻找差异

0x03 进程注入检测

命令:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 malfind

功能:

  • 查找隐藏或注入的代码/DLL
  • 检测进程内存中的异常区域

示例输出分析:

  • 检测到PID为620的svchost.exe存在异常

0x04 内存提取与分析

进程内存提取:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 procdump -p 620 -D dump
python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 memdump -p 620 -D dump

后续分析:

  • 将提取的文件上传至VirusTotal进行检测
  • 成功检测出Meterpreter攻击痕迹

0x05 YARA规则检测Meterpreter

自定义YARA规则(fm.yara):

rule Find_Meterpreter{
    meta:
        desrciption = "it's the Meterpreter!"
    strings:
        $a = { 6D 65 74 73 72 76 2E 64 6C 6C 00 00 52 65 66 6C 65 63 74 69 76 65 4C 6F 61 64 65 72 }
        $b = "stdapi_" ascii nocase
    condition:
        $a and $b
}

执行检测:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 yarascan -y fm.yara

参考资源:

  • http://cyberforensicator.com/2018/03/11/finding-metasploits-meterpreter-traces-with-memory-forensics/

0x06 DLL分析

DLL查看:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 dlllist -p 1656
python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 ldrmodules

DLL提取:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 dlldump -p 1656 -D dump

关键点:

  • ldrmodules可检测隐藏的DLL
  • 提取的DLL可上传至VirusTotal检测

0x07 文件句柄分析

命令:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 handles -p 620 -t file

功能:

  • 查看进程打开的文件句柄
  • 检测异常文件访问

0x08 命令行历史分析

命令:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 cmdscan

功能:

  • 查看内存中保留的cmd命令
  • 可检测powershell命令执行记录

0x09 IE浏览器历史记录分析

方法1:iehistory插件

python vol.py -f /root/lltest/PC-20170527XAOD-20180410-073551.raw --profile=Win7SP1x86 iehistory

方法2:yarascan搜索

python vol.py -f /root/lltest/PC-20170527XAOD-20180410-073551.raw --profile=Win7SP1x86 pslist | grep iexplore
python vol.py -f /root/lltest/PC-20170527XAOD-20180410-073551.raw --profile=Win7SP1x86 yarascan -Y "/(URL|REDR|LEAK)/" -p 1904,220,3276,3676

方法3:memdump+strings

python vol.py -f /root/lltest/PC-20170527XAOD-20180410-073551.raw --profile=Win7SP1x86 memdump -p 1904,220,3276,3676 -D dump
strings dump/1904.dmp | grep -i http:// | sort | uniq -u

0x10 注册表分析

启动项检查:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 printkey -K "Microsoft\Windows\CurrentVersion\Run"

用户账户检查:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 printkey -K "SAM\Domains\Account\Users\Names"

ShimCache分析:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 shimcache

UserAssist分析:

python vol.py -f /root/lltest/PC-20170527XAOD-20180407-042003.raw --profile=Win7SP1x86 userassist

0x11 服务分析

命令:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 svcscan

功能:

  • 查看系统服务信息
  • 检测恶意服务

0x12 内核驱动分析

基本驱动查看:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 modules

隐藏驱动检测:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 modscan
python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 driverscan

0x13 文件系统分析

命令:

python vol.py -f /root/lltest/PC-20170527XAOD-20180409-232828.raw --profile=Win7SP1x86 filescan

功能:

  • 检测rootkit隐藏文件
  • 扫描内存中的文件对象

0x14 时间线分析

命令:

python vol.py -f /root/lltest/PC-20170527XAOD-20180407-042003.raw --profile=Win7SP1x86 timeliner --output=text --output-file=out1.txt

建议:

  • 输出内容较多,建议重定向到文件
  • 可用于构建攻击时间线

参考资源

  1. Volatility官方命令参考:https://github.com/volatilityfoundation/volatility/wiki/Command-Reference
  2. Meterpreter检测方法:http://cyberforensicator.com/2018/03/11/finding-metasploits-meterpreter-traces-with-memory-forensics/
  3. 高级恶意软件检测:https://eforensicsmag.com/finding-advanced-malware-using-volatility/
  4. IE缓存历史记录扫描:https://volatility-labs.blogspot.com/2012/09/howto-scan-for-internet-cachehistory.html
利用Volatility进行入侵痕迹分析 - 完整教学指南 0x00 环境准备 工具准备: Volatility:Kali Linux 2自带版本2.4,建议使用最新版本2.6 下载地址:https://github.com/volatilityfoundation/volatility Windows内存镜像工具:DumpIt等 系统要求: 本文以Windows系统内存镜像为例进行分析 示例镜像:PC-20170527XAOD-20180409-232828.raw 示例系统配置:Win7SP1x86 0x01 网络连接分析 命令: 功能: 查看系统网络连接情况 识别异常连接和远程IP 0x02 进程分析 基本进程查看: 隐藏进程检测: 关键点: psxview可以检测通过DKOM等技术隐藏的进程 对比pslist和psxview结果寻找差异 0x03 进程注入检测 命令: 功能: 查找隐藏或注入的代码/DLL 检测进程内存中的异常区域 示例输出分析: 检测到PID为620的svchost.exe存在异常 0x04 内存提取与分析 进程内存提取: 后续分析: 将提取的文件上传至VirusTotal进行检测 成功检测出Meterpreter攻击痕迹 0x05 YARA规则检测Meterpreter 自定义YARA规则(fm.yara): 执行检测: 参考资源: http://cyberforensicator.com/2018/03/11/finding-metasploits-meterpreter-traces-with-memory-forensics/ 0x06 DLL分析 DLL查看: DLL提取: 关键点: ldrmodules可检测隐藏的DLL 提取的DLL可上传至VirusTotal检测 0x07 文件句柄分析 命令: 功能: 查看进程打开的文件句柄 检测异常文件访问 0x08 命令行历史分析 命令: 功能: 查看内存中保留的cmd命令 可检测powershell命令执行记录 0x09 IE浏览器历史记录分析 方法1:iehistory插件 方法2:yarascan搜索 方法3:memdump+strings 0x10 注册表分析 启动项检查: 用户账户检查: ShimCache分析: UserAssist分析: 0x11 服务分析 命令: 功能: 查看系统服务信息 检测恶意服务 0x12 内核驱动分析 基本驱动查看: 隐藏驱动检测: 0x13 文件系统分析 命令: 功能: 检测rootkit隐藏文件 扫描内存中的文件对象 0x14 时间线分析 命令: 建议: 输出内容较多,建议重定向到文件 可用于构建攻击时间线 参考资源 Volatility官方命令参考:https://github.com/volatilityfoundation/volatility/wiki/Command-Reference Meterpreter检测方法:http://cyberforensicator.com/2018/03/11/finding-metasploits-meterpreter-traces-with-memory-forensics/ 高级恶意软件检测:https://eforensicsmag.com/finding-advanced-malware-using-volatility/ IE缓存历史记录扫描:https://volatility-labs.blogspot.com/2012/09/howto-scan-for-internet-cachehistory.html