T1071.002 Splunk · SPL

Detect File Transfer Protocols in Splunk

Adversaries may communicate using application layer protocols associated with transferring files to avoid detection/network filtering 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. Protocols such as SMB, FTP, FTPS, and TFTP that transfer files may be very common in environments. Packets produced from these protocols may have many fields and headers in which data can be concealed. Data could also be concealed within the transferred files. An adversary may abuse these protocols to communicate with systems under their control within a victim network while also mimicking normal, expected traffic.

MITRE ATT&CK

Tactic
Command and Control
Technique
T1071 Application Layer Protocol
Sub-technique
T1071.002 File Transfer Protocols
Canonical reference
https://attack.mitre.org/techniques/T1071/002/

SPL Detection Query

Splunk (SPL)
spl
index=network OR index=firewall sourcetype IN ("stream:ftp", "stream:smb", "pan:traffic", "cisco:asa")
  (dest_port IN (20, 21, 445, 139, 69, 990))
  action=allowed
  NOT (dest_ip="10.*" OR dest_ip="172.16.*" OR dest_ip="192.168.*" OR dest_ip="127.*")
| eval Protocol=case(
    dest_port IN (20, 21, 990), "FTP/FTPS",
    dest_port IN (445, 139), "SMB",
    dest_port=69, "TFTP",
    1=1, "Unknown")
| stats count as ConnectionCount, sum(bytes_out) as BytesSent, sum(bytes_in) as BytesReceived, earliest(_time) as FirstSeen, latest(_time) as LastSeen, values(user) as Users by src_ip, dest_ip, dest_port, Protocol, process_name
| where ConnectionCount > 3
| eval ExfilRisk=if(BytesSent > 10485760, "HIGH", if(BytesSent > 1048576, "MEDIUM", "LOW"))
| table FirstSeen, LastSeen, src_ip, dest_ip, dest_port, Protocol, process_name, Users, ConnectionCount, BytesSent, BytesReceived, ExfilRisk
| sort - ConnectionCount
high severity high confidence

Detects outbound file transfer protocol connections (FTP, SMB, TFTP) to external IP addresses using firewall and network stream data. Calculates data transfer volumes and assigns an exfiltration risk score based on bytes sent. Outbound SMB to the internet is almost always malicious — legitimate SMB traffic should be confined to internal networks. FTP C2 is used by APT groups including APT41, Kimsuky, SilverTerrier, and Dragonfly.

Data Sources

Network Traffic: Network Connection CreationNetwork Traffic: Network Traffic FlowFirewall LogsNetwork Stream Data

Required Sourcetypes

stream:ftpstream:smbpan:trafficcisco:asa

False Positives & Tuning

  • Legitimate FTP file transfers to external vendors or partner organizations (common in manufacturing, healthcare, and finance)
  • SFTP/FTPS connections to cloud-hosted file exchange platforms (e.g., GoAnywhere, MOVEit)
  • SMB connections through VPN tunnels to remote offices that appear as public IPs before NAT
  • Automated backup scripts that upload to external FTP servers
Download portable Sigma rule (.yml)

Other platforms for T1071.002


Testing Methodology

Validate this detection against 3 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.

  1. Test 1FTP C2 Simulation via Built-in Client

    Expected signal: Sysmon Event ID 1: Process creation for ftp.exe with -s: flag pointing to script file. Sysmon Event ID 3: Network connection attempt to 127.0.0.1:21. Sysmon Event ID 11: File creation of ftp_c2.txt in TEMP directory.

  2. Test 2SMB Named Pipe C2 Simulation

    Expected signal: Sysmon Event ID 17: Pipe Created with PipeName=\\msagent_f1. Sysmon Event ID 1: PowerShell process creation with named pipe creation in command line. The pipe name 'msagent_f1' is a known Cobalt Strike default pipe name pattern.

  3. Test 3FTP Data Exfiltration via curl

    Expected signal: Sysmon for Linux Event ID 3: Network connection from curl to 127.0.0.1:21. Process creation event for curl with -T (upload) flag and ftp:// URL. File creation event for the test file.

Unlock Pro Content

Get the full detection package for T1071.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections