146 lines
5.6 KiB
Markdown
146 lines
5.6 KiB
Markdown
# T1071 - Standard Application Layer Protocol
|
|
## [Description from ATT&CK](https://attack.mitre.org/wiki/Technique/T1071)
|
|
<blockquote>Adversaries may communicate using a common, standardized application layer protocol such as HTTP, HTTPS, SMTP, or DNS to avoid detection by blending in with existing traffic. Commands to the remote system, and often the results of those commands, will be embedded within the protocol traffic between the client and server.
|
|
|
|
For connections that occur internally within an enclave (such as those between a proxy or pivot node and other nodes), commonly used protocols are RPC, SSH, or RDP.</blockquote>
|
|
|
|
## Atomic Tests
|
|
|
|
- [Atomic Test #1 - Malicious User Agents](#atomic-test-1---malicious-user-agents)
|
|
|
|
- [Atomic Test #2 - Malicious User Agents - Nix](#atomic-test-2---malicious-user-agents---nix)
|
|
|
|
- [Atomic Test #3 - DNS Large Query Volume](#atomic-test-3---dns-large-query-volume)
|
|
|
|
- [Atomic Test #4 - DNS Regular Beaconing](#atomic-test-4---dns-regular-beaconing)
|
|
|
|
- [Atomic Test #5 - DNS Long Domain Query](#atomic-test-5---dns-long-domain-query)
|
|
|
|
|
|
<br/>
|
|
|
|
## Atomic Test #1 - Malicious User Agents
|
|
This test simulates an infected host beaconing to command and control.
|
|
Inspired by APTSimulator - https://github.com/NextronSystems/APTSimulator/blob/master/test-sets/command-and-control/malicious-user-agents.bat
|
|
|
|
**Supported Platforms:** Windows
|
|
|
|
|
|
#### Inputs
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| domain | Default domain to simulate against | string | www.google.com|
|
|
|
|
#### Run it with `powershell`!
|
|
```
|
|
Invoke-WebRequest #{domain} -UserAgent "HttpBrowser/1.0" | out-null
|
|
Invoke-WebRequest #{domain} -UserAgent "Wget/1.9+cvs-stable (Red Hat modified)" | out-null
|
|
Invoke-WebRequest #{domain} -UserAgent "Opera/8.81 (Windows NT 6.0; U; en)" | out-null
|
|
Invoke-WebRequest #{domain} -UserAgent "*<|>*" | out-null
|
|
```
|
|
|
|
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
## Atomic Test #2 - Malicious User Agents - Nix
|
|
This test simulates an infected host beaconing to command and control.
|
|
Inspired by APTSimulator - https://github.com/NextronSystems/APTSimulator/blob/master/test-sets/command-and-control/malicious-user-agents.bat
|
|
|
|
**Supported Platforms:** Linux, macOS
|
|
|
|
|
|
#### Inputs
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| domain | Default domain to simulate against | string | www.google.com|
|
|
|
|
#### Run it with `sh`!
|
|
```
|
|
curl -s -A "HttpBrowser/1.0" -m3 #{domain}
|
|
curl -s -A "Wget/1.9+cvs-stable (Red Hat modified)" -m3 #{domain}
|
|
curl -s -A "Opera/8.81 (Windows NT 6.0; U; en)" -m3 #{domain}
|
|
curl -s -A "*<|>*" -m3 #{domain}
|
|
```
|
|
|
|
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
## Atomic Test #3 - DNS Large Query Volume
|
|
This test simulates an infected host sending a large volume of DNS queries to a command and control server.
|
|
The intent of this test is to trigger threshold based detection on the number of DNS queries either from a single source system or to a single targe domain.
|
|
|
|
**Supported Platforms:** Windows
|
|
|
|
|
|
#### Inputs
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| domain | Default domain to simulate against | string | example.com|
|
|
| subdomain | Subdomain prepended to the domain name | string | atomicredteam|
|
|
| query_type | DNS query type | string | TXT|
|
|
| query_volume | Number of DNS queries to send | integer | 1000|
|
|
|
|
#### Run it with `powershell`!
|
|
```
|
|
for($i=0; $i -le #{query_volume}; $i++) { Resolve-DnsName -type "#{query_type}" "#{subdomain}.$(Get-Random -Minimum 1 -Maximum 999999).#{domain}" -QuickTimeout}
|
|
```
|
|
|
|
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
## Atomic Test #4 - DNS Regular Beaconing
|
|
This test simulates an infected host beaconing via DNS queries to a command and control server at regular intervals over time.
|
|
This behaviour is typical of implants either in an idle state waiting for instructions or configured to use a low query volume over time to evade threshold based detection.
|
|
|
|
**Supported Platforms:** Windows
|
|
|
|
|
|
#### Inputs
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| domain | Default domain to simulate against | string | example.com|
|
|
| subdomain | Subdomain prepended to the domain name | string | atomicredteam|
|
|
| query_type | DNS query type | string | TXT|
|
|
| c2_interval | Seconds between C2 requests to the command and control server | integer | 30|
|
|
| c2_jitter | Percentage of jitter to add to the C2 interval to create variance in the times between C2 requests | integer | 20|
|
|
| runtime | Time in minutes to run the simulation | integer | 30|
|
|
|
|
#### Run it with `powershell`!
|
|
```
|
|
.\T1071-dns-beacon.ps1 -Domain #{domain} -Subdomain #{subdomain} -QueryType #{query_type} -C2Interval #{c2_interval} -C2Jitter #{c2_jitter} -RunTime #{runtime}
|
|
```
|
|
|
|
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
## Atomic Test #5 - DNS Long Domain Query
|
|
This test simulates an infected host returning data to a command and control server using long domain names.
|
|
The simulation involves sending DNS queries that gradually increase in length until reaching the maximum length. The intent is to test the effectiveness of detection of DNS queries for long domain names over a set threshold.
|
|
|
|
**Supported Platforms:** Windows
|
|
|
|
|
|
#### Inputs
|
|
| Name | Description | Type | Default Value |
|
|
|------|-------------|------|---------------|
|
|
| domain | Default domain to simulate against | string | example.com|
|
|
| subdomain | Subdomain prepended to the domain name (should be 63 characters to test maximum length) | string | atomicredteamatomicredteamatomicredteamatomicredteamatomicredte|
|
|
| query_type | DNS query type | string | TXT|
|
|
|
|
#### Run it with `powershell`!
|
|
```
|
|
.\T1071-dns-domain-length.ps1 -Domain #{domain} -Subdomain #{subdomain} -QueryType #{query_type}
|
|
```
|
|
|
|
|
|
|
|
<br/>
|