$npx -y skills add killvxk/cybersecurity-skills-zh --skill analyzing-memory-forensics-with-lime-and-volatility使用 LiME(Linux Memory Extractor)内核模块进行 Linux 内存采集, 并使用 Volatility 3 框架进行分析。从 Linux 内存镜像中提取进程列表、 网络连接、bash 历史、已加载内核模块和注入代码。 适用于对被入侵 Linux 系统执行事件响应(incident response)。
| 1 | # 使用 LiME 和 Volatility 进行内存取证分析 |
| 2 | |
| 3 | ## 说明 |
| 4 | |
| 5 | 使用 LiME 内核模块采集 Linux 内存,然后使用 Volatility 3 从内存镜像中提取取证制品。 |
| 6 | |
| 7 | ```bash |
| 8 | # LiME 内存采集 |
| 9 | insmod lime-$(uname -r).ko "path=/evidence/memory.lime format=lime" |
| 10 | |
| 11 | # Volatility 3 分析 |
| 12 | vol3 -f /evidence/memory.lime linux.pslist |
| 13 | vol3 -f /evidence/memory.lime linux.bash |
| 14 | vol3 -f /evidence/memory.lime linux.sockstat |
| 15 | ``` |
| 16 | |
| 17 | ```python |
| 18 | import volatility3 |
| 19 | from volatility3.framework import contexts, automagic |
| 20 | from volatility3.plugins.linux import pslist, bash, sockstat |
| 21 | |
| 22 | # Volatility 3 编程方式使用 |
| 23 | context = contexts.Context() |
| 24 | automagics = automagic.available(context) |
| 25 | ``` |
| 26 | |
| 27 | 关键分析步骤: |
| 28 | 1. 使用 LiME 采集内存(format=lime 或 format=raw) |
| 29 | 2. 使用 linux.pslist 列出进程,与 linux.psscan 比对 |
| 30 | 3. 使用 linux.bash 提取 bash 命令历史 |
| 31 | 4. 使用 linux.sockstat 列出网络连接 |
| 32 | 5. 使用 linux.lsmod 检查已加载的内核模块(rootkit 检测) |
| 33 | |
| 34 | ## 示例 |
| 35 | |
| 36 | ```bash |
| 37 | # 完整取证工作流 |
| 38 | vol3 -f memory.lime linux.pslist | grep -v "\[kthread\]" |
| 39 | vol3 -f memory.lime linux.bash |
| 40 | vol3 -f memory.lime linux.malfind |
| 41 | vol3 -f memory.lime linux.lsmod |
| 42 | ``` |