jtsylve/LiME
GitHub: jtsylve/LiME
专用于 Linux 和 Android 设备的内核级内存取证工具,支持全物理内存提取与网络传输。
Stars: 1954 | Forks: 367
# LiME ~ Linux 内存提取器
这是一个可加载内核模块 (LKM),支持从 Linux 和基于 Linux 的设备(例如 Android)获取易失性内存。这使得 LiME 独一无二,因为它是第一个允许在 Android 设备上进行完整内存捕获的工具。在获取过程中,它最大限度地减少了用户空间和内核空间进程之间的交互,这使得它生成的内存捕获结果比其他为 Linux 内存获取设计的工具更具取证可靠性。
## 目录
* [功能特性](#features)
* [使用方法](#usage)
* [示例](#example)
* [演示](#present)
## 功能特性
* 完整的 Android 内存获取
* 通过网络接口获取
* 极小的进程占用
* 转储内存的哈希值
## 使用方法
关于 LiME 的使用方法和内部机制的详细文档可以在项目的 "doc" 目录中找到。
LiME 利用 insmod 命令加载模块,并传递执行所需的参数。
```
insmod ./lime.ko "path=> format= [digest=] [dio=<0|1>]"
path (required): outfile ~ name of file to write to on local system (SD Card)
tcp:port ~ network port to communicate over
format (required): padded ~ pads all non-System RAM ranges with 0s
lime ~ each range prepended with fixed-size header containing address space info
raw ~ concatenates all System RAM ranges (warning : original position of dumped memory is likely to be lost therefore making analysis in most forensics tools impossible. This format is not recommended except for advanced users)
digest (optional): Hash the RAM and provide a .digest file with the sum.
Supports kernel version 2.6.11 and up. See below for
available digest options.
compress (optional): 1 ~ compress output with zlib
0 ~ do not compress (default)
dio (optional): 1 ~ attempt to enable Direct IO
0 ~ do not attempt Direct IO (default)
localhostonly (optional): 1 ~ restricts the tcp to only listen on localhost,
0 ~ binds on all interfaces (default)
timeout (optional): 1000 ~ max amount of milliseconds tolerated to read a page (default).
If a page exceeds the timeout all the memory region are skipped.
0 ~ disable the timeout so the slow region will be acquired.
This feature is only available on kernel versions >= 2.6.35.
```
## 示例
在这个例子中,我们使用 adb 加载 LiME,然后通过网络进行获取操作
```
$ adb push lime.ko /sdcard/lime.ko
$ adb forward tcp:4444 tcp:4444
$ adb shell
$ su
# insmod /sdcard/lime.ko "path=tcp:4444 format=lime"
```
现在在主机上,我们可以建立连接并使用 netcat 获取内存
```
$ nc localhost 4444 > ram.lime
```
获取到 sdcard
```
# insmod /sdcard/lime.ko "path=/sdcard/ram.lime format=lime"
```
## 可用的摘要算法
实际上,LiME 支持内核库支持的任何摘要算法。
通过 tcp 转储时收集摘要文件需要 2 个单独的连接。
```
$ nc localhost 4444 > ram.lime
$ nc localhost 4444 > ram.sha1
```
为了快速参考,这里列出了支持的摘要算法。
### 所有内核版本
```
crc32c
md4, md5
sha1, sha224, sha256, sha384, sha512
wp512, wp384, wp256
```
### 4.10 及以上
```
sha3-224, sha3-256, sha3-384, sha3-512
```
### 3.0 及以上
```
rmd128, rmd160, rmd256, rmd320
```
## 压缩
压缩可以显著减少获取内存捕获所需的时间。与未压缩的传输相比,它可以实现 4 倍的加速,且仅增加少量内存开销(约 24 KB)。
RAM 文件将采用 zlib 格式,这与 gzip 或 zip 格式不同。原因是内核中嵌入的 deflate 库不支持 gzip 或 zip。
要解压它,你可以使用 [pigz](https://zlib.net/pigz/) 或任何兼容 zlib 的库。
```
$ nc localhost 4444 | unpigz > ram.lime
```
请注意,只有 RAM 文件被压缩。摘要文件未压缩,哈希值将与未压缩的数据匹配。
## 演示
LiME 由 Joe Sylve 在 2012 年的 Shmoocon 上首次展示。
Youtube~ Android Mind Reading: Memory Acquisition and Analysis with DMD and Volatility
标签:0day挖掘, Android, Cutter, DSL, Insmod, JARM, LiME, LKM, Ruby on Rails, SecList, Zlib压缩, 内存分析, 内存取证, 内存转储, 内核安全, 内核模块, 安全资源, 客户端加密, 库, 应急响应, 数字取证, 数据捕获, 易失性数据获取, 流量嗅探, 目录枚举, 移动安全, 网络安全, 自动化脚本, 隐私保护