SecurityRonin/userassist-forensic
GitHub: SecurityRonin/userassist-forensic
用 Rust 编写的 Windows UserAssist 取证分析器,从 NTUSER.DAT 解码 GUI 程序执行记录并标记伪装和暂存目录异常。
Stars: 0 | Forks: 0
# userassist-取证
[](https://crates.io/crates/userassist-forensic)
[](https://github.com/SecurityRonin/userassist-forensic/actions)
[](https://www.rust-lang.org)
[](https://github.com/rust-secure-code/safety-dance)
[](LICENSE)
[](https://github.com/sponsors/h4x0r)
**证明用户启动了哪些 GUI 程序——以及启动了多少次、上次运行的时间——直接在任何操作系统上从 `NTUSER.DAT` 中读取。** 这是一个通过构造保证不会触发 panic 的 Windows UserAssist artifact 读取器,外加一个用于标记伪装和暂存目录执行的分析器。
## 运行它
```
$ cargo install userassist-forensic # installs the userassist4n6 binary
$ userassist4n6 /path/to/NTUSER.DAT
UserAssist: 61 entries
Findings (5):
[MEDIUM] USERASSIST-SUSPICIOUS-PATH C:\Users\informant\Downloads\icloudsetup.exe
icloudsetup.exe at C:\Users\informant\Downloads\icloudsetup.exe (run count 0) sits in a directory commonly used to stage malware — consistent with suspicious execution.
[MEDIUM] USERASSIST-SUSPICIOUS-PATH C:\Users\informant\AppData\Local\Temp\~nsu.tmp\Au_.exe
Au_.exe … sits in a directory commonly used to stage malware — consistent with suspicious execution.
```
`--all` 列出每次启动(运行次数、最后执行时间、路径),并按时间先后排序。
## 它解码的内容
UserAssist 存在于每个用户的 hive 中,路径为
`Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{GUID}\Count`。有两个 `{GUID}`
子键——一个用于可执行文件,一个用于开始菜单快捷方式。值**名称**是经过 **ROT13** 编码的
程序路径;值**数据**是一个固定的二进制结构体:
- **现代版本 (Windows 7+)** — 72 字节:session id、**运行次数** (offset 4)、**聚焦次数** (8)、
**聚焦时间 ms** (12)、**最后执行 `FILETIME`** (60) → `UserAssistEntry`。
- **旧版** — 16 字节:运行次数 (offset 4)、最后执行 `FILETIME` (8)。
`UEME_CTLSESSION` / `UEME_CTLCUACount` 簿记计数器将被跳过。
## 分层
- **`userassist-core`** — `parse_bytes(&[u8]) -> Vec`。使用
[`winreg-core`] 遍历 hive,对名称进行 ROT13 解码,对每次结构体读取进行边界检查。`#![forbid(unsafe_code)]`,
通过 lint 保证无 panic。
- **`userassist-forensic`** — `analyze_bytes` + `audit` (分级的 [`forensicnomicon`] 发现结果) 以及
`userassist4n6` CLI。
## 验证
第一梯队验证针对**真实的 `NTUSER.DAT`** —— NIST **CFReDS 数据泄露案例** hive(公有领域)——
并使用独立的 oracle **regipy** 进行交叉验证:
| 解码路径 | 运行次数 | 最后执行 `FILETIME` |
|---|---|---|
| `C:\Users\Public\Desktop\Google Chrome.lnk` | 2 | `130716052100840000` |
| `C:\Users\informant\Desktop\Download\ccsetup504.exe` | 1 | `130717690768820000` |
| `C:\Users\informant\AppData\Local\Temp\~nsu.tmp\Au_.exe` | 0 | `0` |
regipy 和 `userassist-core` 在条目数量(**61**,不包含计数器)以及每个
解码字段上保持一致。详见 `core/tests/data/README.md`。
## 发现结果
| 代码 | 严重程度 | MITRE | 触发条件 |
|---|---|---|---|
| `USERASSIST-SYSTEM-BINARY-RELOCATED` | 高 | T1036.005 | Windows 系统二进制文件名称从非 `System32` 路径启动(伪装)。 |
| `USERASSIST-SUSPICIOUS-PATH` | 中 | T1204 | 程序从常见的暂存目录(Temp、Downloads、`$Recycle.Bin` 等)启动。 |
[隐私政策](https://securityronin.github.io/userassist-forensic/privacy/) · [服务条款](https://securityronin.github.io/userassist-forensic/terms/) · © 2026 Security Ronin Ltd
标签:可视化界面, 通知系统