Detect Exfiltration Over Alternative Protocol in Elastic Security
Adversaries may steal data by exfiltrating it over a different protocol than that used for command and control. Data may be sent over FTP, SMTP, DNS, SMB, HTTP/S, or any other network protocol not serving as the primary C2 channel. Adversaries often encrypt or obfuscate these alternate channels. Common tools include curl, ftp.exe, WinSCP, and built-in OS utilities. DNS tunneling (encoding data in DNS query subdomains) is a particularly stealthy variant used by malware families like FrameworkPOS. IaaS and SaaS platforms (Exchange, SharePoint, GitHub, AWS S3) can also serve as exfiltration endpoints via cloud APIs or direct downloads.
MITRE ATT&CK
- Tactic
- Exfiltration
- Canonical reference
- https://attack.mitre.org/techniques/T1048/
Elastic Detection Query
sequence by host.name with maxspan=1h
[process where event.type == "start" and
process.name in~ ("ftp.exe", "curl.exe", "winscp.exe", "pscp.exe", "sftp.exe", "ncftp.exe", "wget.exe", "bitsadmin.exe", "robocopy.exe") and
(
process.args : ("-T", "--upload-file", "PUT", "STOR", "ftp://*", "sftp://*", "ftps://*", "-F", "--form", "smtp://*", "--mail-from", "--mail-rcpt")
)
]
[network where event.type == "connection" and
destination.port in (21, 22, 25, 465, 587, 989, 990, 2121, 2222) and
not destination.ip : ("10.*", "172.16.*", "172.17.*", "172.18.*", "172.19.*", "172.20.*", "172.21.*", "172.22.*", "172.23.*", "172.24.*", "172.25.*", "172.26.*", "172.27.*", "172.28.*", "172.29.*", "172.30.*", "172.31.*", "192.168.*", "127.*")
]
// Branch 2: High-volume DNS queries suggesting tunneling
sequence by host.name, process.name with maxspan=1h
[dns where event.type == "protocol" and
dns.question.name : "*" and
string_length(dns.question.name) > 50 and
not dns.question.name : ("*.microsoft.com", "*.windows.com", "*.google.com", "*.amazon.com", "*.cloudfront.net")
] with runs=20 Detects exfiltration over alternative protocols by correlating process launch of known transfer tools with upload indicators and outbound connections on exfil-relevant ports (FTP, SMTP, SSH, SFTP). Also detects DNS tunneling via anomalously long DNS query subdomains (>50 chars) or high DNS query volume to a single domain within a short window.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate backup software (robocopy, bitsadmin) transferring large datasets to external SFTP/FTP storage endpoints during scheduled maintenance windows
- Security scanning tools or IT asset management agents using curl to upload diagnostic bundles to vendor cloud infrastructure over HTTPS on port 443 mapped to alt ports
- Long DNS hostnames from CDN providers or certificate transparency logs causing false positives on the DNS tunneling branch — allowlist known CDN and PKI domains
Other platforms for T1048
Testing Methodology
Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1FTP Upload via Windows Built-in FTP Client
Expected signal: Sysmon Event ID 1: Process Create with Image=ftp.exe, CommandLine containing '-s:%TEMP%\df00tech-ftp.txt'. Sysmon Event ID 3: Network Connection attempt to 127.0.0.1:21 from ftp.exe. Sysmon Event ID 11: File create for the ftp script file in TEMP.
- Test 2curl SMTP Exfiltration Simulation
Expected signal: Sysmon Event ID 1: Process Create with Image=curl.exe, CommandLine containing '--mail-from', '--mail-rcpt', '--upload-file', 'smtp://'. Sysmon Event ID 3: Network Connection to 127.0.0.1:25 from curl.exe. The connection will fail but telemetry events fire.
- Test 3DNS Tunneling Simulation via Long Subdomain Queries
Expected signal: Sysmon Event ID 22 (DNS Query): 25 events with QueryName containing long base64-encoded subdomains (>50 characters) under df00tech-test.com. DNS queries will fail to resolve (NXDOMAIN) but the DNS telemetry events are generated by the Sysmon DNS query logging provider.
- Test 4curl Upload via HTTP PUT (Alternative Protocol Exfiltration)
Expected signal: Sysmon Event ID 1: Process Create with Image=curl.exe, CommandLine containing '-X PUT', '-T', and 'http://127.0.0.1:8888'. Sysmon Event ID 3: Network Connection to 127.0.0.1:8888. Sysmon Event ID 11: File Create for exfil_test.txt in TEMP directory.
- Test 5SCP File Exfiltration via OpenSSH (Linux/macOS)
Expected signal: Auditd EXECVE record for scp with arguments including the destination host and port. Network connection event to 198.51.100.1:22. On systems with Sysmon for Linux: Process Create event (EventCode=1) for scp binary, Network Connect (EventCode=3) for the outbound SSH connection attempt.
References (12)
- https://attack.mitre.org/techniques/T1048/
- http://researchcenter.paloaltonetworks.com/2016/10/unit42-oilrig-malware-campaign-updates-toolset-and-expands-targets/
- https://labs.sentinelone.com/20-common-tools-techniques-used-by-macos-threat-actors-malware/
- https://blog.talosintelligence.com/poetrat-update-april-2020/
- https://www.sentinelone.com/labs/frameworkpos-another-pos-threat-using-dns-for-exfiltration/
- https://www.welivesecurity.com/2021/01/26/operation-windmill-eset-research-kobalos/
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa23-352a
- https://www.trendmicro.com/vinfo/us/security/news/ransomware-by-the-numbers/play-ransomware
- https://arxiv.org/ftp/arxiv/papers/1408/1408.1136.pdf
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1048/T1048.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/network_connection
Unlock Pro Content
Get the full detection package for T1048 including response playbook, investigation guide, and atomic red team tests.