Registry forensics in memory: hives, keys and artifacts from RAM
7 min read
The registry is usually analysed from hive files pulled off disk. A memory image holds the same hives as the kernel sees them at capture time: loaded, possibly modified since the last flush, and including keys that only ever exist in RAM. This post covers how ramparser finds the hives, reads keys and values, decodes the usual DFIR artifacts, and where memory cannot give you an answer. Technique names follow The Art of Memory Forensics, chapter 10, and the Volatility registry plugins.
hivelist: finding the hives
Every loaded hive is a _CMHIVE in kernel memory, linked through its
HiveList field into the nt!CmpHiveListHead list. hivelist walks
that list with symbol-accurate offsets from the kernel PDB and reports
each hive's _CMHIVE address and backing file, from FileFullPath
or, when a build leaves it empty, FileUserName.
The walk is virtual, through the kernel page tables, not a physical
signature scan: FileFullPath sits deep enough in the structure that
it often lands on another page. Hives with no backing file, such as
\REGISTRY\MACHINE\HARDWARE, show an empty name. Those are memory-only
by design.
When the name is missing, ramparser identifies the hive by its
top-level keys (ControlSet00x and Select mean SYSTEM, Policy
means SECURITY, Local Settings means a user's UsrClass, and so on),
then mounts it under its usual Windows path: HKLM\SYSTEM,
HKU\<user>, and the rest.
Reading keys: the cell map
A key path does not map to a flat file offset in memory. Hive bins are scattered across pool allocations, so each 32-bit cell index has to be translated through the hive's cell map, exactly as Volatility does:
- bit 31 selects stable or volatile storage;
- the next 10 bits index the map directory, the next 9 the table;
- the low 12 bits are the offset inside the bin's page.
The resulting _HMAP_ENTRY gives the bin address. On Windows 10 1803
and later, hive bins live in the address space of the minimal
Registry process, and ramparser reads them through that process's
page tables.
From a key's nk record the walk follows the subkey list, whichever
of the four forms it takes (lf, lh, li or the ri index of
lists), and the value list of vk records. Values larger than one
cell are stored as db big-data records; their segments are
reassembled so a large binary value comes back whole.
printkey uses this to dump every hive a few levels deep as a table.
The registry browser reads any key on demand with no depth limit.
It accepts pasted paths (HKLM\..., HKEY_CURRENT_USER\...), follows
symbolic links such as CurrentControlSet, shows each value's bytes in
hex, and searches under the selected key.
Volatile keys
Keys created with REG_OPTION_VOLATILE sit in the volatile half of
the cell map and are never written to the hive file. The browser reads
both the stable and the volatile subkey lists of every key, so these
keys appear alongside normal ones. They include run-time state that a
disk image lacks, and they are one place to look for configuration
malware wanted to keep off disk.
What memory cannot give you
Hive bins are pageable. If a bin was paged out or never loaded when the dump was taken, the cells inside it cannot be read. ramparser does not drop them quietly. A key whose cell is missing shows "not in memory", an incomplete subkey or value list is flagged as partly paged out, and a value whose data spans missing pages is marked, with the missing bytes shown as zeros. Treat an absent key as "unknown", never as "not set". If the answer matters, confirm it on the disk hive.
Deleted keys and values
When a key or value is deleted, its cell is freed but the nk or vk
record often survives in the bin until the space is reused. On demand,
ramparser walks each hive's bins and decodes the records still sitting
in free cells: key names with last-write time and parent cell, value
names with their type. Only small values stored inline in the vk
record keep their data. Larger data lived in a separate cell, which is
usually reallocated, and is reported as freed. Typical finds are a
persistence key cleared after use, a removed account, or a wiped MRU.
regf_scan: base blocks outside the hive list
regf_scan (on demand) scans physical memory for page-aligned regf
base blocks with a known version (1.3 to 1.6). It reports the embedded
file path, root cell, sequence numbers and whether the two sequence
numbers match. The UI lists separately the blocks whose file is not
already in hivelist: cached copies, or a hive loaded but not linked.
This is a pointer for follow-up. ramparser does not rebuild a
browsable hive from a carved base block.
Decoded artifacts
The registry plugin runs the decoders of registry-parser, several
hundred of them, on the in-memory hives, each on the hive type it
applies to. The ones analysts reach for first:
| Artifact | Hive | What it answers |
|---|---|---|
| ShimCache (AppCompatCache) | SYSTEM | executables the system saw, with file modified time |
| BAM | SYSTEM | last execution per user SID |
| Amcache | Amcache.hve | executed files with SHA-1 |
| UserAssist | NTUSER | GUI launches, run count, last run (ROT13 decoded) |
| Shellbags | UsrClass / NTUSER | folders the user browsed, including removable and network paths |
| USBSTOR, USB devices | SYSTEM | storage devices connected |
| Services, audit policy | SYSTEM, SECURITY | how the machine was configured |
One interpretation note for ShimCache: Windows writes the
AppCompatCache value when the system shuts down. The copy in a
loaded SYSTEM hive reflects the last write, not every execution since
boot.
ramparser correlates these results into findings: a system binary name
running from outside System32, a look-alike name one edit away from
a system binary, programs run from user-writable folders or another
drive, USB storage connected in the week before capture (rated
higher when Amcache shows a program run from another drive within a
few hours of the connection), local accounts
created after installation, and security settings turned down
(UseLogonCredential=1 for WDigest, EnableLUA=0,
LocalAccountTokenFilterPolicy=1, Defender disabled by policy,
AlwaysInstallElevated, Defender exclusions).
Persistence keys
persistence_scan targets the classic autostart locations in every
loaded hive: Run and RunOnce (including Wow6432Node and the
per-user copies), Winlogon Userinit / Shell / VmApplet /
System / Taskman, the Debugger and GlobalFlag values under
Image File Execution Options, and ImagePath / ServiceDll under
ControlSet001\Services. Each row carries the key's last-write time.
The autostart map joins these with the service list and the process snapshot. For each entry it shows where the program lives (Windows, Program Files, a user-writable folder, Temp or Downloads) and whether it is running now. Services that do not start on their own are left out.
From the decoded artifacts, these raise high-severity findings: a
Winlogon Shell other than explorer.exe, a Userinit with anything
appended, a non-empty AppInit_DLLs, an IFEO Debugger, a hidden
scheduled task, and any autostart pointing into a user-writable
folder. registry_search adds a keyword slice over the key walk
(AppInit_DLLs, AppCertDlls, Notify, BootExecute, MRU lists and others)
for a quick manual pass.
False positives are real. Software updaters live in AppData and use
Run keys, and IFEO GlobalFlag values are set by debugging tools.
Confirm with the running process and its file before you escalate.
Practical workflow
- Check
hivelist. Expect SYSTEM, SOFTWARE, SAM, SECURITY, DEFAULT and one NTUSER/UsrClass pair per logged-on user. - Read the autostart map and the "changed shortly before the capture" panel, which lists keys whose last-write time falls just before acquisition.
- Cross the execution artifacts (ShimCache, BAM, UserAssist, Amcache)
with
pslistandpsscan. - Open the deleted-records view on NTUSER and SOFTWARE to catch cleanup.
- For anything that matters and shows as paged out, go to the disk hive.