| ID | Technique | Tactic |
|---|---|---|
| T1572 | Protocol Tunneling | Command and Control |
Detection: Windows Potential Cloudflared Tunnel Execution
Description
This analytic detects Cloudflare Tunnel client execution by its process name or original executable name, including renamed copies, and by command lines that create token-authenticated or Quick Tunnels.
Threat actors have used cloudflared for covert command-and-control and persistent remote access, including renamed binaries and tunnels that expose local services through Cloudflare's edge.
The command-line signatures focus on token-backed tunnel run, Quick Tunnel commands that publish a loopback service with --url, and config-backed tunnel --config ... run commands.
Search
1
2| tstats `security_content_summariesonly`
3 count min(_time) as firstTime
4 max(_time) as lastTime
5
6from datamodel=Endpoint.Processes where
7
8Processes.process_name IN ("cloudflared.exe")
9OR
10Processes.original_file_name IN ("cloudflared.exe")
11OR (
12 Processes.process="*tunnel*"
13 Processes.process IN ("*--token*", "*--url*", "*--config*")
14)
15
16by Processes.process Processes.vendor_product Processes.user_id Processes.process_hash
17 Processes.parent_process_name Processes.parent_process_exec Processes.action
18 Processes.dest Processes.process_current_directory Processes.process_path
19 Processes.process_integrity_level Processes.original_file_name Processes.parent_process
20 Processes.parent_process_path Processes.parent_process_guid Processes.parent_process_id
21 Processes.process_guid Processes.process_id Processes.user Processes.process_name
22
23
24| `drop_dm_object_name(Processes)`
25
26| `security_content_ctime(firstTime)`
27
28| `security_content_ctime(lastTime)`
29
30
31| eval has_exe_prefix=if(match(process, "(?i)^\\s*(?:\"[^\"]+\\.exe\"
32|[^\\s]+\\.exe)(?:\\s
33|$)"), 1, 0)
34
35
36| eval is_tunnel_cmd=if(match(process, "(?i)\\btunnel(\\s
37|$)"), 1, 0)
38
39
40| eval has_run=if(match(process, "(?i)\\srun(\\s
41|$)"), 1, 0)
42
43
44| eval has_token=if(match(process, "(?i)\\s--token(-file)?([=\\s]
45|$)"), 1, 0)
46
47
48| eval has_config=if(match(process, "(?i)\\s--config([=\\s]
49|$)"), 1, 0)
50
51
52| eval quick_tunnel_loopback=if(match(process, "(?i)--url(?:=
53|\\s+)(?:\"?)(?:https?://)?(?:localhost
54|127\\.0\\.0\\.1
55|0\\.0\\.0\\.0
56|\\[::1\\])(?:[:/\\s\"]
57|$)"), 1, 0)
58
59
60| eval token_tunnel_ordered=if(match(process, "(?i)\\btunnel\\b.*\\brun\\s+--token(-file)?([=\\s]
61|$)"), 1, 0)
62
63
64| eval config_tunnel_ordered=if(match(process, "(?i)\\btunnel\\b.*--config(?:=
65|\\s+)(?:\"[^\"]+\"
66|[^\\s]+).*\\brun(?:\\s
67|$)"), 1, 0)
68
69
70| eval quick_tunnel_ordered=if(match(process, "(?i)\\btunnel\\b.*--url(?:=
71|\\s+)(?:\"?)(?:https?://)?(?:localhost
72|127\\.0\\.0\\.1
73|0\\.0\\.0\\.0
74|\\[::1\\])(?:[:/\\s\"]
75|$)"), 1, 0)
76
77
78| eval cloudflared_token_tunnel=if(has_exe_prefix=1 AND is_tunnel_cmd=1 AND has_run=1 AND has_token=1 AND token_tunnel_ordered=1, 1, 0)
79
80
81| eval cloudflared_quick_tunnel=if(has_exe_prefix=1 AND is_tunnel_cmd=1 AND quick_tunnel_loopback=1 AND quick_tunnel_ordered=1, 1, 0)
82
83
84| eval cloudflared_config_tunnel=if(has_exe_prefix=1 AND is_tunnel_cmd=1 AND has_run=1 AND has_config=1 AND config_tunnel_ordered=1, 1, 0)
85
86
87| where process_name IN ("cloudflared.exe") OR original_file_name IN ("cloudflared.exe") OR cloudflared_token_tunnel=1 OR cloudflared_quick_tunnel=1 OR cloudflared_config_tunnel=1
88
89
90| `windows_potential_cloudflared_tunnel_execution_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Windows Event Log Security 4688 | 'XmlWinEventLog' |
'XmlWinEventLog:Security' |
|
| CrowdStrike ProcessRollup2 | Other | 'crowdstrike:events:sensor' |
'crowdstrike' |
| Sysmon EventID 1 | 'XmlWinEventLog' |
'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational' |
Macros Used
| Name | Value |
|---|---|
| security_content_ctime | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$) |
| windows_potential_cloudflared_tunnel_execution_filter | search * |
windows_potential_cloudflared_tunnel_execution_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
The detection uses endpoint process telemetry mapped to the Processes node of the Endpoint data model. Ingest full command lines, process names, original file names, parent process, user, and destination fields from Linux or Windows EDR or Sysmon data, and normalize them to the Splunk Common Information Model (CIM).
Known False Positives
Authorized administrators, DevOps teams, and developers may run cloudflared to publish local services or establish config-backed tunnels. Review the executable location, parent process, user, token handling, destination service, and whether the activity is approved before tuning the detection.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| Potential Cloudflared tunnel execution observed on [$dest$] with the CommandLine [$process$]. | dest | system | 20 |
Threat Objects
| Field | Type |
|---|---|
| parent_process_name | parent_process_name |
| process_name | process_name |
References
-
https://www.guidepointsecurity.com/blog/tunnel-vision-cloudflared-abused-in-the-wild/
-
https://web-assets.esetstatic.com/wls/en/papers/white-papers/cyberespionage-gamaredon-way.pdf
-
https://developers.cloudflare.com/tunnel/reference/run-parameters/
-
https://www.reconinfosec.com/articles/emergence-of-akira-ransomware-group/
Detection Testing
| Test Type | Status | Dataset | Source | Sourcetype |
|---|---|---|---|---|
| Validation | ✅ Passing | N/A | N/A | N/A |
| Unit | ✅ Passing | Dataset | XmlWinEventLog:Security |
XmlWinEventLog |
| Integration | ✅ Passing | Dataset | XmlWinEventLog:Security |
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: 3