PowerShell timestomping via file timestamp property and setter usage (Windows)

Identifies PowerShell timestomping attempts by matching script text that sets file creation, access, and write timestamps.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_script
Author
frack113 (SigmaHQ), DRL 1.1
Published
2021-08-03
Updated
2026-07-31
title: PowerShell timestomping via file timestamp property and setter usage (Windows)
id: a0f7a1d4-e82b-4b75-86e7-d2dc12fe8754
status: test
description: This rule flags PowerShell script content that sets or assigns file timestamp properties and uses .NET methods to change file creation, last access, and last write times. Attackers may timestomp files to obscure activity by making timestamps appear consistent with existing files or normal activity. The detection relies on PowerShell Script Block Logging telemetry matching specific timestamp property and setter expressions.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1070.006/T1070.006.md
  - https://www.offensive-security.com/metasploit-unleashed/timestomp/
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_timestomp.yml
author: frack113, Huntrule Team
date: 2021-08-03
modified: 2022-12-25
tags:
  - attack.stealth
  - attack.t1070.006
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection_ioc:
    ScriptBlockText|contains:
      - .CreationTime =
      - .LastWriteTime =
      - .LastAccessTime =
      - "[IO.File]::SetCreationTime"
      - "[IO.File]::SetLastAccessTime"
      - "[IO.File]::SetLastWriteTime"
  condition: selection_ioc
falsepositives:
  - Legitimate admin script
level: medium
license: DRL-1.1
related:
  - id: c6438007-e081-42ce-9483-b067fbef33c3
    type: derived