Execution
ShimCache (AppCompatCache)
ShimCache (AppCompatCache) cheat sheet: SYSTEM hive location, entry limits per Windows version, ordering, timestamp meaning and execution caveats.
- Location
- SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatCache
- Proves
- A file path was seen by the compatibility engine; on Win 7/8, likely execution
- Timestamps
- Per-entry file $SI modification time as FILETIME, UTC (not an execution time); SYSTEM key LastWrite marks the last flush
- Retention
- Written only at shutdown or reboot; capped at 1,024 entries (96 on XP, 512 on 2003), oldest evicted; newest entries only in RAM
- Access
- Administrator; SYSTEM hive locked live: raw NTFS (KAPE), VSS or reg save; a live copy holds only the last flushed cache
- Evidence of
- Execution
- Type
- Registry
- Windows
- XPVista / 78 / 8.11011
- KAPE target
- RegistryHivesSystem
- Velociraptor
- Windows.Triage.Targets:RegistryHivesSystem
Tools
Compare all toolsWhat it is
The Application Compatibility Cache, usually called ShimCache, is kept by the Windows compatibility engine to decide quickly whether an executable needs a compatibility shim. Each entry records a file path and that file's last-modification time. The cache lives in kernel memory and is serialized into the SYSTEM hive, which makes it a long-lived record of executables the system has encountered, including files that no longer exist.
Location
| Windows version | Key (SYSTEM hive) | Max entries |
|---|---|---|
| XP | ControlSet00x\Control\Session Manager\AppCompatibility\AppCompatCache | 96 |
| Server 2003 | ControlSet00x\Control\Session Manager\AppCompatCache\AppCompatCache | 512 |
| Vista / 7 / 8 / 8.1 | ControlSet00x\Control\Session Manager\AppCompatCache\AppCompatCache | 1,024 |
| 10 / 11 | ControlSet00x\Control\Session Manager\AppCompatCache\AppCompatCache | 1,024 |
On a live system the path starts with HKLM\SYSTEM\CurrentControlSet; in an offline hive read the Select key to find which ControlSet00x was current (see control set). Every control set can hold its own copy.
What it proves
- Presence: a file existed at that path, with that modification time, when the compatibility engine evaluated it.
- Execution, version-dependent: on Windows 7 and 8 an entry carries a flag set when the process was actually created, so parsers can show "Executed". On Windows 10 and 11 no such flag is exposed by the common parsers, and entries are also added when Explorer merely displays or inspects executables. Treat an entry as "seen", not "run", unless another artifact confirms execution.
- Order: entries are stored most recent first, so relative position gives a rough sequence even when no execution time exists.
- It does not record the user, the run count or the execution time.
Key fields
| Field | Meaning |
|---|---|
| Cache entry position | 0 = most recently inserted or updated entry |
| Path | Full path of the executable (or script / DLL on some versions) |
| Last modified time | $STANDARD_INFORMATION modification time of the file when cached |
| Executed / insert flag | Windows 7/8 only: process creation observed |
| File size | Windows XP only |
| Data | Version-specific extra bytes (on Windows 10+, packaged-app information) |
Timestamps
| Timestamp | Set when | Format | Pitfalls |
|---|---|---|---|
| Last modified time | Copied from the file's $SI modification time when the entry is created or updated | FILETIME, UTC | It is not an execution time; it reflects the file's own mtime, which timestomping can alter |
| SYSTEM hive / key LastWrite | Cache flushed to the registry | FILETIME, UTC | Usually the last clean shutdown or reboot, not the moment an entry was added |
Retention and clearing
- The cache is written to the registry at shutdown or reboot. On a system that has not restarted since the incident, the newest entries exist only in memory: acquire RAM (or hiberfil.sys) to get them.
- When the limit is reached the oldest entries are evicted.
- Modifying a file (new mtime) updates its entry and moves it to the top.
- A cleared or truncated cache with recent LastWrite is suspicious; compare control sets and shadow copies of the SYSTEM hive.
Collection
- KAPE target:
RegistryHivesSystem(SYSTEM with transaction logs) - Velociraptor (
Windows.Triage.Targets):RegistryHivesSystem - Built-in (administrator):
reg save HKLM\SYSTEM E:\case\SYSTEM.hiv
reg save exports the live hive, which still contains only the last flushed cache.
Parsing tools
- AppCompatCacheParser (Eric Zimmerman):
AppCompatCacheParser.exe -f SYSTEM --csv E:\out. All control sets are extracted by default (-cselects one); without-fit reads the live registry;--nlignores transaction logs. - ShimCacheParser (Mandiant, open source): parses hives, exported
.regfiles and memory output. - RegRipper:
appcompatcacheplugin. - Velociraptor:
Windows.Registry.AppCompatCacheon live endpoints. - Volatility: the
shimcacheplugins read the in-memory cache that has not been flushed yet.
Investigation tips
- Search for tools and payloads in user-writable locations and for known attacker file names; ShimCache often keeps them long after the files and their Prefetch are gone.
- Use the position of a known-good executable with a known run time to bracket when a suspicious neighbour entry was added.
- A last-modified time older than the file's creation on disk, or an unusual round value, can indicate timestomping.
- Always confirm execution on Windows 10/11 with Amcache, BAM/DAM, Prefetch or process-creation events.
- Parse every
ControlSet00xand shadow-copy SYSTEM hive: older copies can contain entries evicted from the current cache.
Related artifacts
- Amcache.hveAmcache.hve cheat sheet: file and program inventory keys, SHA-1 hashes, PE metadata, timestamps and why an entry alone does not prove execution.
- Prefetch Files (.pf)Windows Prefetch cheat sheet: .pf location per version, run count, the last eight run times, referenced files, retention limits and how to parse.
- BAM / DAM (Background Activity Moderator)BAM and DAM cheat sheet: SYSTEM hive keys per Windows 10 build, per-user SIDs, last execution FILETIME, seven-day retention and investigation tips.
- Registry hivesRegistry hives cheat sheet: SYSTEM, SOFTWARE, SAM, SECURITY, NTUSER.DAT, UsrClass.dat, transaction logs, RegBack, LastWrite times and collection.
- hiberfil.sys (hibernation file)hiberfil.sys cheat sheet: what hibernation and Fast Startup save, compression by Windows version, converting it to a raw memory image and what it can reveal.
Glossary terms
- Evidence of executionArtifacts that show a program actually ran on a Windows system, as opposed to merely existing on disk, and how strongly each one supports that claim.
- ControlSet and CurrentControlSetThe numbered configuration sets in the SYSTEM hive; CurrentControlSet is a runtime link that does not exist in an offline hive file.
- TimestompingAn anti-forensic technique that alters a file's timestamps to hide when it was created, modified, or accessed.
- FILETIMEThe 64-bit Windows timestamp format counting 100-nanosecond intervals since 1 January 1601 UTC, used by NTFS, the registry and many artifacts.