Detection of Timestomping on Windows Executables
Detection and mitigation guidance for identifying timestomping activity where adversaries modify creation timestamps of executable files in sensitive system directories to evade detection.
Adversaries frequently employ timestomping to manipulate the metadata of malicious files, allowing them to blend in with legitimate system files or appear older than they are, thereby evading signature-based or heuristic detection systems. This technique involves modifying the creation, access, or modification timestamps of files.
Defenders should focus on monitoring the modification of creation timestamps for executable files (such as .exe, .dll, .sys, .msi, .scr, .pif, and .lnk) within sensitive Windows directories, including C:\Windows\System32, C:\ProgramData, and user-specific startup folders. The detection logic provided identifies suspicious file creation time changes initiated by non-system processes, effectively distinguishing malicious activity from routine system operations or enterprise maintenance tasks that update binary metadata.
Attack Chain
- Attacker gains initial access or establishes persistence on the target Windows system.
- Attacker downloads or stages a malicious executable or shortcut (.lnk) file.
- Attacker executes a timestomping utility or utilizes Windows API calls (such as SetFileTime) to modify the file's creation timestamp.
- The operating system updates the file metadata, triggering a Sysmon Event ID 2.
- The attacker places or moves the modified file into a sensitive system or startup directory (e.g.,
C:\Windows\System32orAppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup). - The modified file masquerades as a legitimate system binary or older, trusted file, bypassing simple temporal-based detection methods.
- The attacker triggers the execution of the malicious file to maintain persistence or conduct further lateral movement.
Impact
Successful timestomping undermines forensic timelines, makes malicious files appear benign, and assists in the long-term persistence of threats on a system. If undetected, attackers can maintain a foothold in the environment, facilitating ongoing data exfiltration, lateral movement, or ransomware deployment.
Recommendation
- Enable Sysmon Event ID 2 (File Creation Time Change) logging across all endpoints to capture the necessary telemetry.
- Deploy the provided Sigma rule to your SIEM to monitor for unauthorized modifications to creation timestamps in sensitive directories.
- Establish a baseline for automated administrative and update processes to tune the rule and minimize false positives.
- Investigate any alerts generated for files located in startup directories as high-priority, as these are often indicators of persistence mechanisms.
Immediate actions
Enable Sysmon Event ID 2 on endpoint assets
Threat Hunt
Search for files with creation dates significantly older than the OS installation date
Data: File system metadata logs
Mitigations
Review and restrict write permissions in System32 and Startup directories
T1070.006
Detection coverage 1
Potential Timestomp in Executable Files
mediumIdentifies the modification of a file creation time for executable files in sensitive system directories.
Detection queries are available on the platform. Get full rules →