SecurityRonin/prefetch-forensic
GitHub: SecurityRonin/prefetch-forensic
跨平台的 Windows Prefetch 取证解析库,无需 Windows API 即可解析 SCCA 格式并提取程序执行证据与可疑行为发现。
Stars: 0 | Forks: 0
# prefetch-取证
[](https://crates.io/crates/prefetch-core)
[](https://crates.io/crates/prefetch-forensic)
[](https://docs.rs/prefetch-forensic)
[](https://www.rust-lang.org)
[](LICENSE)
[](https://github.com/sponsors/h4x0r)
[](https://github.com/SecurityRonin/prefetch-forensic/actions/workflows/ci.yml)
[](https://github.com/rust-secure-code/safety-dance/)
[](deny.toml)
**直接通过 `.pf` 文件,在任何 OS 上证明 Windows 主机上运行过什么——以及何时运行、运行频率和来源。** 一个不会 panic 的 prefetch 读取器(`MAM`/Xpress-Huffman + SCCA v30/31)外加一个对伪装和可疑位置执行进行评级分析的工具。
```
// One call: execution evidence + graded findings, from a raw .pf file.
let (rec, findings) = prefetch_forensic::audit_bytes(&std::fs::read("COREUPDATER.EXE-157C54BB.pf")?)?;
println!("{} ran {}x, last {:?}, from {:?}",
rec.executable, rec.run_count, rec.last_run_filetimes.first(), rec.image_path);
// → COREUPDATER.EXE ran 1x, last 132449604494103203, from \…\SYSTEM32\COREUPDATER.EXE
```
大多数 prefetch 工具(PECmd、WinPrefetchView、windowsprefetch)通过调用 Windows API `RtlDecompressBufferEx` 来解压 Win10+ 的 prefetch——因此它们只能在 **Windows 上**运行。prefetch-forensic 自带了纯净室的 [MS-XCA] Xpress-Huffman 解码器([`xpress-huffman`](https://github.com/SecurityRonin/xpress-huffman)),因此它也可以在 **Linux 和 macOS** 上解析 Windows prefetch。
## 两个 crate
| Crate | 作用 |
|---|---|
| **`prefetch-core`** | 读取器:`MAM`/Xpress-Huffman 解压 + SCCA v30/31 解析 → `PrefetchInfo`(可执行文件、运行次数、最后 8 次运行时间、卷序列号/路径、已加载文件)。不产生发现结果。 |
| **`prefetch-forensic`** | 分析器:`execution_record()`(证据)+ `audit()` → 经过评级的 `forensicnomicon` 发现结果。 |
```
[dependencies]
prefetch-forensic = "0.1" # pulls in prefetch-core
```
## 分析器会标记的内容
| 代码 | 严重性 | MITRE | 触发条件 |
|---|---|---|---|
| `PREFETCH-SYSTEM-BINARY-RELOCATED` | 高 | T1036.005 | 一个仅限 System32 的二进制文件名(`svchost.exe`、`lsass.exe` 等)从 `System32`/`SysWOW64` 之外被加载 |
| `PREFETCH-SUSPICIOUS-EXEC-PATH` | 中 | T1204 | 镜像文件从恶意软件暂存目录(Temp、Downloads、`$Recycle.Bin`、PerfLogs 等)运行 |
设计上保证了高精度:一个正常的 `System32` 程序——包括真实的 Case 001 恶意软件 `coreupdater.exe`(攻击者用一个新名称将其植入*在* System32 中)——会生成其执行证据,但**不会产生误报**。仅凭 Prefetch 就能证明它运行过;而这是否属于恶意行为则是一个关联/判定问题。发现结果只代表客观观察,绝非最终裁决。
## 信任,但验证
- **`#![forbid(unsafe_code)]`**,在生产环境中没有 `unwrap`/`expect`/panic——每一个 SCCA 偏移量和长度都经过了边界检查。
- **已通过独立的外部预言机进行验证**,基于真实的 **Stolen Szechuan Sauce**(Case 001)恶意软件 prefetch:解压器与 Fox-IT 的 `dissect.util` 在字节上是完全一致的,并且解析出的 SCCA 字段与 Adam Witt 的 `windowsprefetch` 相匹配。详见 [`docs/validation.md`](docs/validation.md)。
[隐私政策](https://securityronin.github.io/prefetch-forensic/privacy/) · [服务条款](https://securityronin.github.io/prefetch-forensic/terms/) · © 2026 Security Ronin Ltd
标签:DNS 解析, Rust, Windows Prefetch, 可视化界面, 子域名变形, 数字取证, 网络流量审计, 自动化脚本, 解析器, 通知系统