Skip to content

Lesson 9 of 19 · 24m

Proving Execution: Prefetch, ShimCache, AmCache and the USN Journal

Four independent NTFS and registry artifacts that record a binary ran — run counts, timestamps, SHA1s and journal entries that survive the file's deletion.

The attacker deleted rclone.exe and emptied the prefetch directory. Windows had already written four independent records that the binary existed and ran — in the registry, in a hive file, in the NTFS journal, and in a SQLite database nobody thinks to wipe. Execution evidence on Windows is redundant by design; your job is knowing where each copy lives and what its lifetime is.

Prefetch: the performance cache that doubles as a launch log

C:\Windows\Prefetch\*.pf is written by the Sysmain service to speed up subsequent launches. The filename is BINARYNAME-XXXXXXXX.pf where the hash derives from the binary's full path — evil.exe run from C:\Temp and C:\Users\ produce different .pf files, so a "duplicate" prefetch is actually two launch locations. Inside the file: a run count, the last eight run timestamps, and the list of files the binary touched. Windows 10/11 caps the directory at 1024 files and compresses the format (MAM) — parse with Eric Zimmerman's PECmd, which handles the compression and prints the run-count table.

Two limits worth stating plainly. Prefetch only fires for binaries launched from disk — anything loaded reflectively into memory never appears. And it only exists if Sysmain ran; check EnablePrefetcher in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters before treating an empty directory as a negative finding.

ShimCache: written at shutdown, ordered by execution

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatCache — the Application Compatibility Cache — keeps an insertion-ordered list of executables the system saw. Two mechanics matter. First, the cache lives in memory and is flushed to the registry at shutdown — a box powered off mid-incident leaves last boot's cache, not this boot's. Second, on Windows 10/11 the entries carry an execution flag proving the binary ran; on Windows 7/8 entries prove only that the file existed on the filesystem — a subtlety the tool output won't explain to you.

AppCompatCacheParser converts it to a CSV ordered by execution sequence — "PsExec clone ran, then the staging tool, then the cleanup utility" reconstructed in the order the attacker used them.

AmCache.hve: the fingerprint record

C:\Windows\AppCompat\Programs\Amcache.hve is written by the ProgramDataUpdater scheduled task — periodically, not at shutdown — and records per-binary SHA1, file size, full path, PE linker timestamp, and version metadata. The SHA1 is the payoff: it survives the file's deletion and pins the exact build that ran, which is how you tell two different rclone.exe payloads apart. Parse it with AmcacheParser. On very new Windows 11 builds Microsoft has been thinning what AmCache records; verify the hive populated before relying on its absence as a finding.

The USN Journal: NTFS's memory of everything

$Extend\$UsnJrnl:$J records every create, delete, rename, and metadata write per file — including files whose $MFT records have since been recycled. MFTECmd -f "$J" reconstructs the journal, and it is where deleted-file names live after deletion. Pair it with $LogFile (the NTFS transaction journal) and the timestomp check falls out: SetFileTime can only touch the $STANDARD_INFORMATION attribute's timestamps. The $FILE_NAME attribute — the copy of timestamps stored with the filename — is not reachable by any user-mode API, so a stomped file shows $STANDARD_INFORMATION dates that disagree with its own $FILE_NAME record. Get-Item in PowerShell only ever shows you the attacker's version. Raw $MFT parsing shows you both.

SRUM: the quiet witness

C:\Windows\System32\sru\sru.db — the System Resource Usage Monitor — logs per-process CPU, network bytes sent/received, and energy consumption for about 30 days. A renamed payload still ran as itself in SRUM, and its network-byte total is your exfiltration lower bound. SrumECmd exports it.

Collect it raw, in one pass

Acquire all of it in a single triage sweep — KAPE's !BasicCollection-style targets pull Prefetch, $MFT, $J, $LogFile, the registry hives, and sru.db in one run against a mounted or live volume. Never open the hives on the live box; copy raw and parse offline. Four write paths, four lifetimes, four independent proofs — wiping one leaves three.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.