Files
atomic-red-team/atomics/T1099/T1099.md
T
2019-09-03 13:36:10 +00:00

188 lines
5.7 KiB
Markdown

# T1099 - Timestomp
## [Description from ATT&CK](https://attack.mitre.org/wiki/Technique/T1099)
<blockquote>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. This is done, for example, on files that have been modified or created by the adversary so that they do not appear conspicuous to forensic investigators or file analysis tools. Timestomping may be used along with file name [Masquerading](https://attack.mitre.org/techniques/T1036) to hide malware and tools. (Citation: WindowsIR Anti-Forensic Techniques)</blockquote>
## Atomic Tests
- [Atomic Test #1 - Set a file's access timestamp](#atomic-test-1---set-a-files-access-timestamp)
- [Atomic Test #2 - Set a file's modification timestamp](#atomic-test-2---set-a-files-modification-timestamp)
- [Atomic Test #3 - Set a file's creation timestamp](#atomic-test-3---set-a-files-creation-timestamp)
- [Atomic Test #4 - Modify file timestamps using reference file](#atomic-test-4---modify-file-timestamps-using-reference-file)
- [Atomic Test #5 - Windows - Modify file creation timestamp with PowerShell](#atomic-test-5---windows---modify-file-creation-timestamp-with-powershell)
- [Atomic Test #6 - Windows - Modify file last modified timestamp with PowerShell](#atomic-test-6---windows---modify-file-last-modified-timestamp-with-powershell)
- [Atomic Test #7 - Windows - Modify file last access timestamp with PowerShell](#atomic-test-7---windows---modify-file-last-access-timestamp-with-powershell)
<br/>
## Atomic Test #1 - Set a file's access timestamp
Stomps on the access timestamp of a file
**Supported Platforms:** Linux, macOS
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| target_filename | Path of file that we are going to stomp on last access time | Path | /opt/filename|
#### Run it with `sh`!
```
touch -a -t 197001010000.00 #{target_filename}
```
<br/>
<br/>
## Atomic Test #2 - Set a file's modification timestamp
Stomps on the modification timestamp of a file
**Supported Platforms:** Linux, macOS
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| target_filename | Path of file that we are going to stomp on last access time | Path | /opt/filename|
#### Run it with `sh`!
```
touch -m -t 197001010000.00 #{target_filename}
```
<br/>
<br/>
## 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
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| target_filename | Path of file that we are going to stomp on last access time | Path | /opt/filename|
#### Run it with `sh`!
```
NOW=$(date)
date -s "1970-01-01 00:00:00"
touch #{target_filename}
date -s "$NOW"
stat #{target_filename}
```
<br/>
<br/>
## 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
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| reference_file_path | Path of reference file to read timestamps from | Path | /bin/sh|
| target_file_path | Path of file to modify timestamps of | Path | /opt/filename|
#### Run it with `sh`!
```
touch -acmr #{reference_file_path} {target_file_path}
```
<br/>
<br/>
## 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.
**Supported Platforms:** Windows
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| file_path | Path of file to change creation timestamp | Path | C:\Some\file.txt|
| target_date_time | Date/time to replace original timestamps with | String | 1970-01-01 00:00:00|
#### Run it with `command_prompt`!
```
powershell.exe Get-ChildItem #{file_path} | % { $_.CreationTime = #{target_date_time} }
```
<br/>
<br/>
## 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.
**Supported Platforms:** Windows
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| file_path | Path of file to change last modified timestamp | Path | C:\Some\file.txt|
| target_date_time | Date/time to replace original timestamps with | String | 1970-01-01 00:00:00|
#### Run it with `command_prompt`!
```
powershell.exe Get-ChildItem #{file_path} | % { $_.LastWriteTime = #{target_date_time} }
```
<br/>
<br/>
## 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.
**Supported Platforms:** Windows
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| file_path | Path of file to change last access timestamp | Path | C:\Some\file.txt|
| target_date_time | Date/time to replace original timestamps with | String | 1970-01-01 00:00:00|
#### Run it with `command_prompt`!
```
powershell.exe Get-ChildItem #{file_path} | % { $_.LastAccessTime = #{target_date_time} }
```
<br/>