SecurityRonin/shimcache-forensic

GitHub: SecurityRonin/shimcache-forensic

一款用 Rust 编写的 Windows ShimCache 取证分析工具,从 SYSTEM 注册表配置单元解码 AppCompatCache 数据并自动标记可疑执行行为。

Stars: 0 | Forks: 0

# shimcache-forensic [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/SecurityRonin/shimcache-forensic/actions) [![Rust 1.85+](https://img.shields.io/badge/rust-1.85%2B-orange.svg)](https://www.rust-lang.org) [![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance) [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE) [![Sponsor](https://img.shields.io/badge/sponsor-h4x0r-ea4aaa?logo=github-sponsors)](https://github.com/sponsors/h4x0r) **证明 Windows 主机上存在过什么 —— 以及在 Windows 7/8 上,什么*运行过* —— 直接从 `SYSTEM` 配置单元的 AppCompatCache (ShimCache) 中提取,支持任何 OS。** 一个构建期即保证无 panic 的解码器(支持 Windows XP 到 11),外加一个能够标记伪装和从暂存目录执行的分析器。 ## 运行方式 ``` $ cargo install shimcache-forensic # installs the shimcache4n6 binary $ shimcache4n6 /path/to/SYSTEM AppCompatCache: Win7_64, ControlSet001, 292 entries Findings (29): [MEDIUM] SHIMCACHE-SUSPICIOUS-PATH C:\Users\INFORM~1\AppData\Local\Temp\eraserInstallBootstrapper\dotNetFx40_Full_setup.exe dotNetFx40_Full_setup.exe at …\eraserInstallBootstrapper\… sits in a directory commonly used to stage malware (execution flag set) — consistent with suspicious execution. [MEDIUM] SHIMCACHE-SUSPICIOUS-PATH C:\$Recycle.Bin\S-1-5-21-…-1000\$RJEMT64.exe $RJEMT64.exe at C:\$Recycle.Bin\… sits in a directory commonly used to stage malware (no execution flag) — consistent with suspicious execution. ``` `--list` 会转储所有缓存条目及其最后修改时间和执行状态。 ## 解码内容 位于 `HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatCache` 的 AppCompatCache 值。每个条目包含:**可执行文件路径**、文件的**最后修改 `FILETIME`**,以及 —— 在 Windows 7/8 上 —— **执行标志**(`insertion_flags & 0x2`)。Windows 10 移除了该标志,因此其 `executed` 状态为 `None`。支持的格式:**Windows XP、Server 2003 / Vista / 2008 (32/64位)、7 (32/64位)、8.0、8.1、10/11** —— 涵盖所有 AppCompatCache 版本。 ## 架构层级 - **`shimcache-core`** —— 纯解码器:`parse(&[u8]) -> Vec`。无注册表依赖,`#![forbid(unsafe_code)]`,无 panic(进行了边界检查)。只要手头有原始值字节,即可在任何地方复用。 - **`shimcache-forensic`** —— `analyze_blob` + `audit`(经 `forensicnomicon` 分级的调查发现)以及 `shimcache4n6` CLI,后者通过 [`winreg-core`](https://crates.io/crates/winreg-core) 从配置单元中读取该值。 ## 验证 针对来自 NIST **CFReDS** “Data Leakage” `SYSTEM` 配置单元(属于公共领域)的**真实** Windows 7 64 位 AppCompatCache 进行的第一层级验证:所有 **292 个条目**均成功解码,其中 `LogonUI.exe`/`bfsvc.exe` 与两个独立预测源(Mandiant 的 `ShimCacheParser` 和基于规范的 libyal dtfabric `appcompatcache.yaml` 解读)的结果完全一致。`shimcache4n6` 在从配置单元提取的端到端过程中复现了相同结果,并揭示案件中在 Temp/`$Recycle.Bin` 目录下的执行行为。详见 `core/tests/data/README.md`。 ## 调查发现 | 代码 | 严重性 | MITRE | 触发条件 | |---|---|---|---| | `SHIMCACHE-SYSTEM-BINARY-RELOCATED` | High | T1036.005 | 记录在非 `System32`/`SysWOW64` 路径下的 Windows 系统二进制文件名称(伪装)。 | | `SHIMCACHE-SUSPICIOUS-PATH` | Medium | T1204 | 路径属于常见暂存目录(Temp、Downloads、`$Recycle.Bin` 等)的条目。 | [隐私政策](https://securityronin.github.io/shimcache-forensic/privacy/) · [服务条款](https://securityronin.github.io/shimcache-forensic/terms/) · © 2026 Security Ronin Ltd
标签:API接口, DNS 反向解析, Rust, ShimCache, 可视化界面, 子域名变形, 数字取证, 网络流量审计, 自动化脚本, 通知系统