| ID | Technique | Tactic |
|---|---|---|
| T1071.003 | Mail Protocols | Command And Control |
Detection: Windows Mail Protocol In Non-Common Process Path
Description
The following analytic detects a Windows application establishing an SMTP connection from a non-common installation path. It leverages Sysmon EventCode 3 to identify processes not typically associated with email clients (e.g., Thunderbird, Outlook) making SMTP connections. This activity is significant as adversaries, including malware like AgentTesla, use such connections for Command and Control (C2) communication to exfiltrate stolen data. If confirmed malicious, this behavior could lead to unauthorized data exfiltration, including sensitive information like desktop screenshots, browser data, and system details, compromising the affected host.
Search
1`sysmon`
2EventCode=3
3NOT Image IN(
4 "C:\\Program Files \(x86\)\\*",
5 "C:\\Program Files\\*",
6 "C:\\Windows\\System32\\*",
7 "C:\\Windows\\SysWOW64\\*"
8)
9(
10 DestinationPortName="smtp"
11 OR
12 DestinationPort IN (25, 587)
13)
14
15| stats count min(_time) as firstTime
16 max(_time) as lastTime
17by action app dest dest_ip dest_port direction dvc protocol protocol_version
18 src src_ip src_port transport user vendor_product process_name
19 process_exec process_guid process_id
20
21| `security_content_ctime(firstTime)`
22
23| `security_content_ctime(lastTime)`
24
25| `windows_mail_protocol_in_non_common_process_path_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Sysmon EventID 3 | 'XmlWinEventLog' |
'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational' |
Macros Used
| Name | Value |
|---|---|
| security_content_ctime | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$) |
| windows_mail_protocol_in_non_common_process_path_filter | search * |
windows_mail_protocol_in_non_common_process_path_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
| Setting | Value |
|---|---|
| Disabled | true |
| Cron Schedule | 0 * * * * |
| Earliest Time | -70m@m |
| Latest Time | -10m@m |
| Schedule Window | auto |
| Creates Risk Event | True |
Implementation
To successfully implement this search, you need to be ingesting logs with the process name and sysmon eventcode = 3 connection events from your endpoints. If you are using Sysmon, you must have at least version 6.0.4 of the Sysmon TA.
Known False Positives
Third party email or SMTP based applications will trigger this. Apply additional filters as needed. Also consider excluding known email or any SMTP based clients installed outside of the Program Files and Windows directories.
Associated Analytic Story
Risk Based Analytics (RBA)
Risk Message:
a process $process_name$ is having a SMTP connection to $dest$ in $dest_ip$
| Risk Object | Risk Object Type | Risk Score | Threat Objects |
|---|---|---|---|
| dest | system | 9 | No Threat Objects |
References
Detection Testing
| Test Type | Status | Dataset | Source | Sourcetype |
|---|---|---|---|---|
| Validation | ✅ Passing | N/A | N/A | N/A |
| Unit | ✅ Passing | Dataset | XmlWinEventLog:Microsoft-Windows-Sysmon/Operational |
XmlWinEventLog |
| Integration | ✅ Passing | Dataset | XmlWinEventLog:Microsoft-Windows-Sysmon/Operational |
XmlWinEventLog |
Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
Source: GitHub | Version: 8