SecurityRonin/amcache-forensic
GitHub: SecurityRonin/amcache-forensic
一款用 Rust 编写的跨平台 Windows Amcache.hve 取证分析工具,解析程序执行痕迹与设备清单并自动标记可疑行为。
Stars: 0 | Forks: 0
# amcache-forensic
[](https://github.com/SecurityRonin/amcache-forensic/actions)
[](https://www.rust-lang.org)
[](https://github.com/rust-secure-code/safety-dance)
[](LICENSE)
[](https://github.com/sponsors/h4x0r)
**证明 Windows 主机上曾存在过什么——并提供用于溯源的 SHA-1——直接在任何操作系统上读取 `Amcache.hve`。** 这是一个构造上确保无 panic 的现代(Windows 10/11)Amcache schema 读取器,外加一个用于标记伪装和暂存目录执行的分析器,每一项发现都带有文件哈希。
## 运行方式
```
$ cargo install amcache-forensic # installs the amcache4n6 binary
$ amcache4n6 /path/to/Amcache.hve
Amcache: 123 file entries, 189 device entries
Findings (4):
[MEDIUM] AMCACHE-SUSPICIOUS-PATH c:\users\testuser\downloads\sysmon\sysmon64.exe
sysmon64.exe at c:\users\testuser\downloads\sysmon\sysmon64.exe (SHA-1 71f5e906848b8e94e951551a08a4c9a045f19a03) sits in a directory commonly used to stage malware — consistent with suspicious execution.
[MEDIUM] AMCACHE-SUSPICIOUS-PATH c:\users\testuser\appdata\local\temp\…\ninite.exe
ninite.exe … (SHA-1 ba7f0b553fe4eb017d2a2b2451f7a3e6ff2b521d) …
```
`--files` 列出所有记录在案的可执行文件(路径、SHA-1、记录时间);`--devices` 列出 PnP/USB 设备。
## 解码内容
支持两种 Amcache schema(`C:\Windows\AppCompat\Programs\Amcache.hve`);`Amcache::schema` 会报告当前使用的是哪种:
- **现代(Windows 10/11)** — `InventoryApplicationFile` → `AmcacheFileEntry`(路径、源自 `FileId` 的 **SHA-1**、发布者、版本、产品、二进制类型、大小、记录 `FILETIME`);`InventoryDevicePnp` → `AmcacheDeviceEntry`(描述、硬件 ID、制造商、型号、类别)。
- **旧版(Windows 8/8.1、Server 2012 R2)** — 1607 之前的 `Root\File\{volume-GUID}\…` 布局,包含带有数字编号的值(`15`=路径,`101`=SHA-1,`100`=程序 ID,`0`=产品,`1`=发布者) → `AmcacheFileEntry`。旧版 hive 不包含设备清单。
## 架构层级
- **`amcache-core`** — `parse_bytes(&[u8]) -> Amcache`。使用 [`winreg-core`] 遍历 hive,包含 `#![forbid(unsafe_code)]`,并通过 lint 确保无 panic。
- **`amcache-forensic`** — `analyze_bytes` + `audit`(分级别的 `forensicnomicon` 发现结果,每一项都将 SHA-1 作为哈希对象)以及 `amcache4n6` CLI。
## 验证
第一层级验证基于来自 **四个 Windows 系统**的**真实 DFIRArtifactMuseum hive(MIT)**,并与**两个独立的对照基准**——Eric Zimmerman 的 `AmcacheParser` 和 `regipy`——进行了交叉核对:
| Hive | 文件数 | 设备数 |
|---|---|---|
| Win10 (APTSimulatorVM) | 123 | 189 |
| Win10 (RathbunVM) | 183 | 185 |
| Win11 (RathbunVM) | 231 | 187 |
| Server 2012 R2 (Stolen Szechuan, 旧版 `Root\File`) | 136 | — |
`7z.exe` → SHA-1 `1189cebeb8ffed7316f98b895ff949a726f4026f`,`CompatTelRunner.exe` → `77f2e744…` —— 与两个对照基准逐字节匹配。详见 `core/tests/data/README.md`。
## 发现结果
| 代码 | 严重程度 | MITRE | 触发条件 |
|---|---|---|---|
| `AMCACHE-SYSTEM-BINARY-RELOCATED` | 高 | T1036.005 | 记录到的 Windows 系统二进制文件名位于非 `System32` 路径下(伪装)。 |
| `AMCACHE-SUSPICIOUS-PATH` | 中 | T1204 | 从常见暂存目录(Temp、Downloads、`$Recycle.Bin` 等)中记录到的可执行文件。 |
[隐私政策](https://securityronin.github.io/amcache-forensic/privacy/) · [服务条款](https://securityronin.github.io/amcache-forensic/terms/) · © 2026 Security Ronin Ltd
标签:Amcache, Rust, Web报告查看器, 可视化界面, 库, 应急响应, 数字取证, 网络流量审计, 自动化脚本, 通知系统