| ID | Technique | Tactic |
|---|---|---|
| T1105 | Ingress Tool Transfer | Command and Control |
| T1218 | System Binary Proxy Execution | Stealth |
| T1567 | Exfiltration Over Web Service | Exfiltration |
Detection: LOLBAS Network Connection On Uncommon Port
Description
The following analytic identifies Living Off the Land Binaries and Scripts (LOLBAS) that can legitimately initiate public network connections but are communicating over uncommon destination ports. It leverages the Network Traffic data model and applies per-binary common-port exclusions to reduce false positives while preserving suspicious non-standard communication. This behavior may indicate payload download, command-and-control, proxy execution, or attempts to blend malicious traffic into trusted Windows binaries. Join this detection with the Process Execution events to provide context and avoid false positives.
Search
1
2| tstats `security_content_summariesonly`
3 count min(_time) as firstTime
4 max(_time) as lastTime
5
6from datamodel=Network_Traffic.All_Traffic where
7
8All_Traffic.app IN (
9 "*\\bitsadmin.exe",
10 "*\\certutil.exe",
11 "*\\cmstp.exe",
12 "*\\cscript.exe",
13 "*\\ftp.exe",
14 "*\\hh.exe",
15 "*\\ie4uinit.exe",
16 "*\\ieexec.exe",
17 "*\\msbuild.exe",
18 "*\\msdt.exe",
19 "*\\mshta.exe",
20 "*\\msiexec.exe",
21 "*\\presentationhost.exe",
22 "*\\settingsynchost.exe",
23 "*\\syncappvpublishingserver.exe",
24 "*\\workfolders.exe",
25 "*\\wscript.exe",
26 "*\\wuauclt.exe"
27 )
28
29NOT All_Traffic.dest_ip IN (
30 "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16",
31 "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16",
32 "192.0.0.0/24", "192.0.0.0/29", "192.0.0.8/32",
33 "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32",
34 "192.0.0.171/32", "192.0.2.0/24", "192.31.196.0/24",
35 "192.52.193.0/24", "192.88.99.0/24", "224.0.0.0/4",
36 "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24",
37 "203.0.113.0/24", "240.0.0.0/4"
38 )
39
40NOT (
41 (
42 All_Traffic.app IN (
43 "*\\cscript.exe",
44 "*\\wscript.exe"
45 )
46 All_Traffic.dest_port IN ("80", "443", "3128")
47 )
48 OR
49 (
50 All_Traffic.app="*\\ftp.exe"
51 All_Traffic.dest_port IN ("20", "21", "989", "990")
52 )
53 OR
54 (
55 All_Traffic.app IN (
56 "*\\bitsadmin.exe",
57 "*\\certutil.exe",
58 "*\\cmstp.exe",
59 "*\\hh.exe",
60 "*\\ieexec.exe",
61 "*\\msbuild.exe",
62 "*\\msdt.exe",
63 "*\\mshta.exe",
64 "*\\msiexec.exe",
65 "*\\presentationhost.exe",
66 "*\\settingsynchost.exe",
67 "*\\syncappvpublishingserver.exe",
68 "*\\workfolders.exe",
69 "*\\wuauclt.exe"
70 )
71 All_Traffic.dest_port IN ("80", "443")
72 )
73 OR
74 (
75 All_Traffic.app IN (
76 "*\\certutil.exe",
77 "*\\ie4uinit.exe"
78 )
79 All_Traffic.dest_port IN ("389")
80 )
81 )
82
83by All_Traffic.action All_Traffic.app All_Traffic.dest
84 All_Traffic.dest_ip All_Traffic.dest_port
85 All_Traffic.direction All_Traffic.dvc All_Traffic.protocol
86 All_Traffic.protocol_version All_Traffic.src
87 All_Traffic.src_ip All_Traffic.src_port
88 All_Traffic.transport All_Traffic.user
89 All_Traffic.vendor_product
90
91
92| `drop_dm_object_name(All_Traffic)`
93
94| `security_content_ctime(firstTime)`
95
96| `security_content_ctime(lastTime)`
97
98| `lolbas_network_connection_on_uncommon_port_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$) |
| lolbas_network_connection_on_uncommon_port_filter | search * |
lolbas_network_connection_on_uncommon_port_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 Finding (Notable) | No |
| Creates Intermediate Finding (Risk Event) | Yes |
Implementation
To successfully implement this detection you must ingest events into the Network Traffic data model that contain the source, destination, destination port, and communicating process name in the app field. Sysmon EventID 3 is a common source for this data when normalized into the Network Traffic data model.
Known False Positives
Legitimate software installation, support tooling, scripting, synchronization, or update workflows may still use uncommon ports in some environments. Tune approved destinations, ports, and process paths with the analytic filter macro.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| LOLBAS process [$app$] on [$src$] connected to public destination [$dest_ip$] over uncommon port [$dest_port$]. | dest | system | 20 |
Threat Objects
| Field | Type |
|---|---|
| dest_ip | ip_address |
| app | process_name |
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: 1