mcpField
A
analyzing-windows-amcache-artifacts

analyzing-windows-amcache-artifacts

github.com/mukul975安全35.2k217 次安装8 周前更新
代码仓库

关于 analyzing-windows-amcache-artifacts

面向事件响应的 Windows Amcache 取证分析技能,指导调查人员解析注册表数据、检查程序与驱动,并与其他执行证据交叉关联。

主要功能

  1. 01收集 Amcache 配置单元及事务日志
  2. 02将条目解析为 CSV 文件
  3. 03检查文件哈希与路径
  4. 04调查已安装程序和驱动
  5. 05关联证据构建时间线

适用场景

  1. 01识别事件期间存在的软件
  2. 02将哈希与恶意软件情报比对
  3. 03调查未授权安装
  4. 04检查可疑驱动记录

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-windows-amcache-artifacts

安装后在 Claude Code 中输入/analyzing-windows-amcache-artifacts确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LICENSE
references/
api-reference.md
scripts/
agent.py

详细介绍

分析 Windows Amcache 痕迹

何时使用

  • 在事件响应期间确定 Windows 系统上曾存在或执行过哪些程序
  • 将 Amcache 中的 SHA-1 哈希与已知恶意软件数据库(VirusTotal、CIRCL、MISP)进行关联
  • 为取证调查构建应用程序安装和执行时间线
  • 识别在文件被删除后仍在 Amcache 中留下痕迹的已删除可执行文件
  • 通过记录曾存在哪些便携式或未授权应用程序来调查内部威胁
  • 分析驱动加载历史以检测 rootkit 或恶意内核模块

不要将其作为程序执行的唯一证据。Amcache 证明文件存在和元数据注册,但 ShimCache(AppCompatCache)和 Prefetch 提供更强的执行证据。将这三类痕迹结合使用才能得出确定性分析。

前提条件

  • C:\Windows\appcompat\Programs\Amcache.hve 的取证镜像或实时分类副本(以及关联的 .LOG1、.LOG2 事务日志)
  • 从 https://ericzimmerman.github.io/ 下载的 Eric Zimmerman 的 AmcacheParser(AmcacheParser.exe)
  • 用于查看解析后 CSV 输出的 Eric Zimmerman 的 Timeline Explorer
  • 可选:用于手动检查注册表配置单元的 Registry Explorer
  • 用于过滤的已知良好可执行文件 SHA-1 白名单(例如 NSRL hashset)
  • 已安装 .NET 6+ 运行时(当前 EZ 工具所需)
  • 对输出目录的写入权限以保存 CSV 结果

工作流

步骤 1:获取 Amcache.hve 文件

从取证镜像或实时系统中提取 Amcache 配置单元:

# From a live system (requires elevated privileges and raw copy tool)
# Amcache.hve is locked by the system; use a raw disk copy tool
# Option A: FTK Imager - mount image and navigate to:
# C:\Windows\appcompat\Programs\Amcache.hve
# Also collect: Amcache.hve.LOG1, Amcache.hve.LOG2

# Option B: Using KAPE for automated triage collection
kape.exe --tsource C: --tdest D:\Evidence\%m --target Amcache

# Option C: From a mounted forensic image (E: = mounted image)
copy "E:\Windows\appcompat\Programs\Amcache.hve" D:\Evidence\
copy "E:\Windows\appcompat\Programs\Amcache.hve.LOG1" D:\Evidence\
copy "E:\Windows\appcompat\Programs\Amcache.hve.LOG2" D:\Evidence\

务必同时收集配置单元旁边的事务日志文件(.LOG1、.LOG2)。AmcacheParser 会重放这些日志中未提交的事务,以恢复尽可能完整的数据。

步骤 2:使用 AmcacheParser 解析 Amcache

对获取的配置单元运行 AmcacheParser:

# Basic parsing with CSV output
AmcacheParser.exe -f "D:\Evidence\Amcache.hve" --csv "D:\Evidence\Output"

# Parse with a SHA-1 whitelist to exclude known-good entries (NSRL)
AmcacheParser.exe -f "D:\Evidence\Amcache.hve" -w "D:\Whitelists\nsrl_sha1.txt" --csv "D:\Evidence\Output"

# Parse with a SHA-1 inclusion list (only show matches against known-bad hashes)
AmcacheParser.exe -f "D:\Evidence\Amcache.hve" -b "D:\IOCs\malware_sha1.txt" --csv "D:\Evidence\Output"

# Include deleted entries with high-precision timestamps
AmcacheParser.exe -f "D:\Evidence\Amcache.hve" --csv "D:\Evidence\Output" -i --mp

AmcacheParser 会在输出目录中生成多个 CSV 文件:

输出文件内容
Amcache_AssociatedFileEntries.csv包含 SHA-1 哈希、路径、大小和时间戳的文件条目
Amcache_UnassociatedFileEntries.csv来自旧版 Amcache 格式的孤立文件条目
Amcache_ProgramEntries.csv已安装程序元数据(名称、发布者、版本、安装日期)
Amcache_DeviceContainers.csvUSB 和设备连接历史
Amcache_DevicePnps.csv即插即用设备驱动信息
Amcache_DriverBinaries.csv已加载的驱动二进制文件及其路径和哈希
步骤 3:分析文件条目中的可疑程序

在 Timeline Explorer 中打开 AssociatedFileEntries.csv 并检查关键列:

Key columns to review:
- ProgramId          : Links file to its parent program entry
- SHA1               : Hash for threat intel lookups
- FullPath           : Original file location on disk
- FileSize           : Size of the executable
- FileKeyLastWriteTimestamp : When the Amcache entry was last updated
- Name               : File name
- Publisher           : Code signing publisher (blank = unsigned)
- BinProductVersion  : Version string from the PE header
- LinkDate           : PE compilation timestamp (useful for detecting timestomping)

筛选可疑指标:

# In Timeline Explorer, apply these filters:

# 1. Find unsigned executables (potentially malicious)
Publisher column = (empty)

# 2. Find executables from suspicious paths
FullPath contains: \temp\, \appdata\, \downloads\, \public\, \programdata\

# 3. Find executables with recent timestamps during incident window
FileKeyLastWriteTimestamp between: 2026-03-15 00:00:00 and 2026-03-16 00:00:00

# 4. Find executables with suspicious compilation dates (timestomping)
LinkDate year < 2015 AND FileKeyLastWriteTimestamp year = 2026
步骤 4:将 SHA-1 哈希与威胁情报关联

提取 SHA-1 哈希并与恶意软件数据库比对:

# Extract unique SHA-1 hashes from the parsed output
# Using PowerShell to extract the SHA1 column
Import-Csv "D:\Evidence\Output\Amcache_AssociatedFileEntries.csv" |
  Select-Object -ExpandProperty SHA1 -Unique |
  Where-Object { $_ -ne "" } |
  Out-File "D:\Evidence\Output\extracted_hashes.txt"

# Check hashes against VirusTotal using vt-cli
foreach ($hash in Get-Content "D:\Evidence\Output\extracted_hashes.txt") {
    vt file $hash --format json | Select-Object -Property meaningful_name, last_analysis_stats
}

# Check hashes against CIRCL hashlookup
foreach ($hash in Get-Content "D:\Evidence\Output\extracted_hashes.txt") {
    Invoke-RestMethod -Uri "https://hashlookup.circl.lu/lookup/sha1/$hash"
}

# Cross-reference with NSRL to identify known-good vs. unknown
# Unknown hashes that are not in NSRL warrant closer investigation
步骤 5:分析程序条目中的未授权安装

查看 ProgramEntries.csv 以发现攻击者可能安装的软件:

Key columns in ProgramEntries:
- ProgramName        : Display name of installed application
- ProgramVersion     : Version string
- Publisher          : Software publisher
- InstallDate        : When the program was installed
- Source             : Installation source (msi, exe, etc.)
- UninstallKey       : Registry uninstall path
- PathsList         : Installation directories

查找:

  • 远程访问工具(AnyDesk、TeamViewer、ngrok、Chisel)
  • 黑客工具(Mimikatz、PsExec、Cobalt Strike)
  • 隧道实用工具(plink、socat、WireGuard)
  • 在事件时间窗口内安装的程序
  • 安装到非标准位置的程序
步骤 6:分析驱动二进制文件中的 rootkit 证据

查看 DriverBinaries.csv 中可疑的已加载驱动:

Key columns in DriverBinaries:
- DriverName         : Name of the driver
- DriverInBox        : Whether it shipped with Windows (false = third-party)
- DriverSigned       : Whether the driver has a valid signature
- DriverTimeStamp    : Compilation timestamp
- Product            : Product associated with the driver
- ProductVersion     : Driver version
- SHA1               : Hash of the driver binary

筛选 DriverInBox = false 和 DriverSigned = false,以查找可能是 rootkit 的未签名第三方驱动,或用于 BYOVD(Bring Your Own Vulnerable Driver)攻击的易受攻击驱动。

步骤 7:根据 Amcache 数据构建时间线

将 Amcache 数据与其他痕迹结合,构建完整的时间线:

# Merge Amcache CSV with other EZ Tools output using Timeline Explorer
# Load the following CSVs into Timeline Explorer:
# - Amcache_AssociatedFileEntries.csv (file evidence)
# - Amcache_ProgramEntries.csv (install evidence)
# - Prefetch output from PECmd.exe (execution evidence)
# - ShimCache output from AppCompatCacheParser.exe (execution evidence)

# Sort all entries by timestamp to reconstruct the attack sequence
# Timeline Explorer supports multi-file loading and column-based sorting

# Export the combined timeline
# File > Save to CSV > combined_timeline.csv

关键概念

术语定义
Amcache.hve位于 C:\Windows\appcompat\Programs\Amcache.hve 的 Windows 注册表配置单元,出于应用程序兼容性目的存储有关应用程序、文件和驱动程序的元数据
关联文件条目链接到特定程序安装的 Amcache 记录,包含文件路径、大小、哈希和时间戳
未关联文件条目来自较旧格式的孤立 Amcache 记录,未链接到程序条目;在 Windows 7/8 系统上常见
程序条目包含安装元数据的 Amcache 记录:程序名称、版本、发布者、安装日期和卸载键
SHA-1 哈希为每个已注册文件存储在 Amcache 中的加密哈希,可通过威胁情报查询识别恶意软件
LinkDate嵌入在可执行文件头中的 PE 编译时间戳;与文件系统时间戳不一致可能表明时间戳篡改
事务日志包含未提交注册表事务的 .LOG1 和 .LOG2 文件,AmcacheParser 会重放这些事务以完整恢复数据
NSRL(National Software Reference Library,国家软件参考库)NIST 维护的已知商业软件 SHA-1 哈希数据库,用作白名单以过滤良性条目

验证

  • 已从取证镜像中收集 Amcache.hve 和事务日志(LOG1、LOG2)
  • AmcacheParser 无错误地生成了所有预期的 CSV 输出文件
  • 已提取 SHA-1 哈希,并与 VirusTotal 或 CIRCL hashlookup 进行了比对
  • 可疑路径中的未签名可执行文件已被标记以供进一步分析
  • 程序条目显示了事件窗口内的所有软件安装
  • 已检查驱动程序二进制文件是否存在未签名或开箱即用条目
  • 已执行 LinkDate 与 FileKeyLastWriteTimestamp 比较以检测时间戳篡改
  • Amcache 发现已与 Prefetch 和 ShimCache 关联以确认执行
  • 最终时间线已将 Amcache 数据与其他取证痕迹整合

评论

支持 Markdown