Skip to content

Prefetch (.pf) Files Forensic Analysis

Windows Prefetch is a performance optimization mechanism designed to accelerate application startup by pre-loading required files and data into memory. For digital forensics and incident response (DFIR) professionals, Prefetch files (.pf) are invaluable artefacts that provide irrefutable evidence of program execution, timestamps, and execution history.

The Prefetch philosophy is based on the principle that files used yesterday are likely to be used today. It is strictly a performance feature, not a security control.

  1. When a program launches, the Windows Cache Manager monitors the first 10 seconds of activity, tracking all accessed files (DLLs, configuration files, etc.).
  2. This list is saved into an executable-specific .pf file in C:\Windows\Prefetch\.
  3. Upon subsequent launches, Windows utilizes this file to proactively load data into memory, significantly reducing perceived startup latency.

Prefetch files are stored in C:\Windows\Prefetch\. The filename follows a strict structure: [EXECUTABLE_NAME]-[FILE_PATH_HASH].pf

  • EXECUTABLE_NAME: The program name (truncated to 29 characters).
  • FILE_PATH_HASH: A unique hash derived from the full path of the executable. This allows Windows to differentiate between identical filenames located in different directories (e.g., svchost.exe in System32 vs. C:\Temp).

Prefetch is a cornerstone for answering the fundamental DFIR question: “Has this specific program been executed on this system?”

  • Proof of Execution: The existence of a .pf file confirms that the associated executable was launched at least once. The file creation date corresponds to the first execution.
  • Timeline Construction: Modern Windows versions (10+) can store up to 8 timestamps of the most recent executions within a single .pf file, allowing for granular timeline reconstruction.
  • Hidden/Masqueraded Executables: Attackers often rename malicious files to legitimate names (e.g., svchost.exe). The path hash will reveal if the file was executed from a suspicious location (e.g., C:\Users\Public\) rather than the expected system path.
  • Execution Frequency: The “Run Count” metric helps differentiate between routine system operations and potentially malicious “one-off” executions.
  • Volume Correlation: Prefetch reveals the volume from which an executable was launched, providing clues about execution from external media (USB drives) or network shares.

Since .pf files are in a compressed binary format, specialized parsing tools are required:

  • PECmd.exe (Eric Zimmerman): The industry-standard CLI tool for deep analysis.
  • WinPrefetchView (NirSoft): A lightweight GUI tool for rapid preliminary analysis.

To effectively hunt for threats using Prefetch, analysts should correlate these findings with other artefacts: