Ora

What is Shimcache?

Published in Windows Artifact 4 mins read

Shimcache, also known as AppCompatCache, is a crucial component of Microsoft Windows' Application Compatibility Database, designed to track application compatibility issues and aid the operating system in running older software. Created by Microsoft beginning in Windows XP, it helps the operating system identify and address potential problems when launching applications.

Understanding Shimcache's Purpose

At its core, Shimcache serves as a historical record of executables that have been run or encountered by a Windows system. Its primary purpose, from Microsoft's perspective, is to improve user experience by ensuring that older applications function correctly on newer versions of Windows.

When an application is launched, Windows consults the Application Compatibility Database. If a known compatibility issue exists, a "shim" (a small code library) is applied to the application to modify its behavior, allowing it to run without error. Shimcache plays a role in this process by recording details about the executables.

How Shimcache Works

Shimcache stores metadata about executables that the system has processed. This information is held in the Windows Registry, specifically at:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatCache

The data is stored in a structured format and includes various details about the files.

Key Data Points Stored in Shimcache

Data Point Description Significance
Full Path The complete directory path to the executable file. Identifies the exact location from which a program was initiated.
File Size The size of the executable file in bytes. Can help detect if a known executable has been tampered with or replaced.
Last Modified Time The last write time (MFT entry) of the executable file. Provides a timestamp indicating when the file itself was last modified.
Last Update Time A timestamp indicating when the Shimcache entry was last written. Often corresponds to when the application was executed or last seen.
Execution Flag A boolean value (True/False) indicating if the file was executed. Crucial for distinguishing between merely seen files and actually executed programs.

It's important to note that Shimcache has a limited capacity (e.g., 1024 entries on newer systems) and operates as a ring buffer, meaning older entries are overwritten by newer ones once the cache is full.

Significance in Digital Forensics and Incident Response

While designed for compatibility, Shimcache has become an invaluable artifact for digital forensics and incident response (DFIR) investigations. Its ability to record executed programs, along with timestamps and file paths, makes it a powerful source of evidence.

Practical Applications:

  • Evidence of Execution: Investigators can use Shimcache to identify programs that have been run on a system, even if other logs have been cleared or modified. This is critical for understanding attacker activity or user behavior.
  • Timeline Analysis: The timestamps within Shimcache (Last Modified Time and Last Update Time) help build a timeline of events, showing when specific executables were present and potentially executed.
  • Malware Identification: By cross-referencing file paths and names with known malware signatures or unusual locations, investigators can pinpoint malicious software execution.
  • Persistence Mechanism Detection: Malicious actors often use legitimate-looking executables or obscure paths for persistence. Shimcache can reveal these entries.
  • User Activity Tracking: For internal investigations, it can help determine which applications were used by a particular user.

Analyzing Shimcache Data

Analyzing Shimcache data typically involves extracting the relevant Registry hive (SYSTEM) and then using specialized forensic tools or scripts to parse the binary data into a human-readable format. Tools like AppCompatCacheParser or features within larger forensic suites can automate this process, presenting the data in tables for easy review and analysis.

History and Evolution

Shimcache was introduced with Windows XP and has continued to be a feature in all subsequent versions of Microsoft Windows. While its structure and the specific information it records have seen minor changes across Windows versions, its fundamental purpose as an application compatibility layer and a record of execution remains consistent.

For more information on the Application Compatibility Database, you can refer to Microsoft's official documentation on Application Compatibility.