Windows Registry Forensics — Structure, Artifacts, and Investigation Techniques
Registry Architecture — Hives, Keys, Values
The Windows Registry is a hierarchical database storing configuration for the OS, applications, and users. It’s organized into hives (discrete files on disk), each mounting at a root key.
System Hives (HKLM — C:WindowsSystem32config)
| Hive File | Mount Point | Contents |
|---|---|---|
SYSTEM |
HKLMSYSTEM | Boot config, drivers, services, ControlSets (CurrentControlSet) |
SOFTWARE |
HKLMSOFTWARE | Installed applications, Windows features, system policies |
SAM |
HKLMSAM | Local account password hashes (SYSKEY encrypted) |
SECURITY |
HKLMSECURITY | Local security policy, cached domain credentials |
COMPONENTS |
HKLMCOMPONENTS | WinSxS component store, servicing stack |
BCD-Template |
(not mounted) | Boot Configuration Data template |
User Hives (HKU — C:Users)
| Hive File | Mount Point | Contents |
|---|---|---|
NTUSER.DAT |
HKU | User profile: shell, app settings, typed paths, MRU lists |
UsrClass.dat |
HKU_Classes | File associations, COM registrations, ShellBag data |
Registry Data Types
| Type | Constant | Description |
|---|---|---|
| REG_SZ | 1 | Null-terminated string |
| REG_EXPAND_SZ | 2 | String with environment variable expansion (e.g., %SystemRoot%) |
| REG_BINARY | 3 | Arbitrary binary data |
| REG_DWORD / REG_DWORD_LITTLE_ENDIAN | 4 | 32-bit integer |
| REG_QWORD / REG_QWORD_LITTLE_ENDIAN | 11 | 64-bit integer |
| REG_MULTI_SZ | 7 | Array of null-terminated strings |
| REG_LINK | 6 | Symbolic link to another key |
| REG_RESOURCE_LIST | 8 | Hardware resource list (PLUGPLAY) |
Critical Forensic Artifacts
1. UserAssist — HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerUserAssist{GUID}Count
Tracks GUI program execution (Start menu, Explorer). Values are ROT13-encoded executable names with run count and last execution timestamp (FILETIME in last 8 bytes of binary data).
# Python decode
import rot13, struct
def decode_userassist(data):
name = rot13(data[:-8].decode('utf-16le').rstrip('x00'))
count, timestamp = struct.unpack('<IQ', data[-8:])
return name, count, timestamp # timestamp = 100ns intervals since 1601-01-01
Forensic value: Proves program execution, frequency, recency. Survives uninstall.
2. ShimCache (AppCompatCache) — HKLMSYSTEMCurrentControlSetControlSession ManagerAppCompatCacheAppCompatCache
Application Compatibility Cache — records every executable run (including from network shares, USB). Binary blob: path, file size, $STANDARD_INFORMATION timestamp, $FILE_NAME timestamp, execution flag.
- Entries added on process creation (not just GUI).
- Max 1024 entries (Win7+) / 512 (XP). FIFO eviction.
- Persists across reboots. Gold standard for execution evidence.
3. Amcache.hve — C:WindowsAppCompatProgramsAmcache.hve
Separate hive (not mounted by default). Richer than ShimCache:
RootFile— file metadata: SHA1, size, company, product, version, full path.RootPrograms— installed programs (MSI, ARP entries).RootInventoryApplication/InventoryApplicationFile— detailed inventory.RootDriverBinary— kernel drivers loaded.
Mount for analysis: reg load HKLMAmcache C:WindowsAppCompatProgramsAmcache.hve.
4. BAM / DAM — Background Activity Moderator / Desktop Activity Moderator
| Key | Purpose | Introduced |
|---|---|---|
HKLMSYSTEMCurrentControlSetServicesbamUserSettings |
Modern Standby / battery-aware: tracks desktop app execution time, CPU usage | Win 10 1709 |
HKLMSYSTEMCurrentControlSetServicesdamUserSettings |
Desktop Activity Moderator: tracks foreground/background state transitions | Win 10 1803 |
Values: executable path → binary blob with last execution timestamp and total runtime. Excellent for timeline reconstruction.
5. RecentDocs / OpenSaveMRU / LastVisitedMRU
HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRecentDocs
HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32OpenSavePIDLMRU
HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerComDlg32LastVisitedPIDLMRU
File access history via Explorer and common dialogs. PIDL (Shell Item ID List) structures parseable with python-registry or shellbags tools.
6. TypedPaths / TypedURLs / RunMRU
HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerTypedPaths
HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerTypedURLs
HKCUSoftwareMicrosoftWindowsCurrentVersionExplorerRunMRU
User-typed paths (Run dialog, Explorer address bar), URLs (IE/Edge address bar), Run dialog history.
7. ShellBags — UsrClass.datLocal SettingsSoftwareMicrosoftWindowsShellBags
Folder view preferences (icon size, sort, position) — but proves folder access. Each Bag subkey = folder visited. Timestamps in ShellBagMRU (MRU list with NodeSlot timestamps).
8. USB Device History — HKLMSYSTEMCurrentControlSetEnumUSBSTOR
Every USB mass storage device ever connected: VID/PID, serial number, first/last connect timestamps (in key LastWriteTime). Correlate with HKLMSYSTEMCurrentControlSetEnumUSB for device class info.
9. Wireless Networks — HKLMSOFTWAREMicrosoftWindows NTCurrentVersionNetworkListProfiles
Wi-Fi profiles: SSID (in ProfileName), BSSID, connection timestamps, authentication type. SignaturesUnmanaged for hidden networks.
10. Service & Driver Configuration — HKLMSYSTEMCurrentControlSetServices
Each service/driver subkey: ImagePath (executable), Start (0=Boot, 1=System, 2=Auto, 3=Demand, 4=Disabled), Type, ErrorControl, ObjectName (service account). Persistence mechanism #1 — malicious services register here.
Live vs Offline Analysis
| Aspect | Live (Running System) | Offline (Disk Image / Mounted Hives) |
|---|---|---|
| Volatile data | Available (cached keys, active sessions) | Lost |
| Locked hives | Cannot copy SAM, SECURITY, SYSTEM (in use) | Full access (Volume Shadow Copy or dead disk) |
| Timestamp accuracy | Current | LastWriteTime of key (may lag) |
| Tooling | reg.exe, PowerShell, Registry Explorer, KAPE | RegRipper, Registry Explorer, hivex, python-registry |
| Integrity | Subject to anti-forensics (rootkits) | Static — can verify hashes |
Best Practice: Hybrid Approach
- Live: Capture volatile data (KAPE
!Registrymodule,reg savefor accessible hives). - Offline: Acquire disk image (FTK Imager, Guymager) or VSS copy. Mount hives read-only. Run RegRipper plugins.
- Correlate: Cross-reference timestamps across artifacts (ShimCache + Amcache + BAM + Prefetch + Event Logs).
Tooling Ecosystem
| Tool | Type | Strengths |
|---|---|---|
| KAPE (Kroll Artifact Parser Extractor) | Live/Targeted collection | Modular, fast, !Registry module extracts all hives via VSS |
RegRipper (Perl / rip.exe) |
Offline parsing | 300+ plugins, timeline output, CSV/JSON/Bodyfile |
| Registry Explorer (Eric Zimmerman) | GUI viewer | Timeline, bookmarks, search, plugin support, loads hive files directly |
| python-registry / hivex | Library | Scriptable parsing, custom plugins, Linux/macOS support |
| RECmd (Eric Zimmerman) | CLI batch | Batch process hives → CSV, timeline, YARA scanning |
| AmcacheParser, AppCompatCacheParser, BAMParser | Specialized | Focused parsers for specific artifacts (Zimmerman suite) |
RegRipper Quick Start
# System hives
rip.exe -r SYSTEM -p system -f timeline
rip.exe -r SOFTWARE -p software -f timeline
# User hives
rip.exe -r NTUSER.DAT -p userassist -f csv
rip.exe -r NTUSER.DAT -p shellbags -f csv
rip.exe -r NTUSER.DAT -p typedurls -f csv
# Amcache (mount first or parse directly)
rip.exe -r Amcache.hve -p amcache -f timeline
# All plugins, all hives
rip.exe -r "C:CasesImageWindowsSystem32config" -a -f timeline -o output.csv
Anti-Forensics & Detection
| Technique | Indicator | Detection |
|---|---|---|
| Timestamp stomping (LastWriteTime) | Key timestamps don’t match value timestamps | Compare key LastWrite vs value timestamps; check $LOGFILE/$UsnJrnl |
| Key/Value deletion | Missing expected artifacts (e.g., no UserAssist) | Baseline comparison; check slack space in hive bins |
| Hive replacement | Hive file hash mismatch; $LOGFILE sequence gap | Hash known-good hives; analyze transaction log |
| Registry virtualization (UAC) | Writes redirected to HKCUSoftwareClassesVirtualStore |
Check VirtualStore; compare HKLM vs HKCU view |
Investigation Workflow — Execution Proof
Question: “Did user bob run malware.exe on 2026-11-01?”
- ShimCache — Search AppCompatCache for
malware.exe. Note timestamp, path. - Amcache — Query
RootFilefor SHA1/path match. Get file metadata, first/last run. - BAM/DAM — Check
UserSettingsfor executable. Get runtime, last launch. - UserAssist — If GUI launch, check ROT13 entry for run count, last execution.
- Prefetch —
C:WindowsPrefetchMALWARE.EXE-.pf— run count, last run, files loaded. - Event Logs — Security 4688 (Process Creation), Sysmon 1 (Process Create), AppLocker.
- Timeline — Merge all timestamps (plaso/log2timeline) → verify consistency.
If 3+ independent artifacts confirm → high confidence. Single artifact → corroborate.
TL;DR — Quick Reference
| Artifact | Location | Answers |
|---|---|---|
| ShimCache | SYSTEM hive | Was executable run? (path, timestamps) |
| Amcache | Amcache.hve | File metadata, SHA1, install info, driver loads |
| UserAssist | NTUSER.DAT | GUI execution count, last run |
| BAM/DAM | SYSTEM hive | Execution time, foreground/background, last launch |
| ShellBags | UsrClass.dat | Folder access proof |
| USBSTOR | SYSTEM hive | USB device history, serial numbers |
| Services | SYSTEM hive | Persistence, malware install |
Next in series: MongoDB WiredTiger Internals — storage engine architecture, checkpoints, and tuning.