Detecting Covert Communication Patterns, Beaconing Cadence, Egress Anomalies & Process-Network Mismatches Across Defensive Telemetry
Adversaries adapt command-and-control (C2) channels to blend into routine enterprise traffic—using HTTPS, DNS, cloud APIs, or customizable HTTP headers/body shapes and jittered polling intervals. Because static signatures easily break when domains or traffic templates change, defenders focus on behavioral and contextual anomalies: unexpected processes initiating external sockets, periodic check-in intervals, mismatched client/user-agent stacks, and unusual egress destinations.
| Hunting Dimension | Anomalous Behavior to Look For | Defensive Mitigation |
|---|---|---|
| Initiating Process | Scripting engines, office apps, or binaries in temp/user directories opening external network connections. | Harden script/execution policies, restrict outbound access from non-approved binaries, and monitor anomalous parent-child chains. |
| Cadence & Timing | Repeated outbound connections with steady or slightly jittered intervals to uncommon external endpoints. | Baseline host egress cadence, investigate recurring low-volume external sessions, and correlate with host/DNS activity. |
| HTTP / TLS / DNS Profile | Unusual user-agents, missing/anomalous SNI or certificates, or high-entropy/TXT DNS query bursts. | Enforce proxy/WAF controls, inspect TLS/DNS metadata in NSM logs, and block known-bad or newly observed high-risk destinations. |
| Egress & Lateral Pivots | Internal hosts reaching external IPs directly without proxy/DNS resolution or pivoting internally after initial contact. | Enforce network segmentation, route egress through controlled proxies/firewalls, and hunt for lateral movement after C2 hits. |
DeviceNetworkEvents
| where Timestamp > ago(24h)
| where ActionType == "ConnectionSuccess"
| where RemoteIPType == "Public"
| where InitiatingProcessFileName !in~ ("chrome.exe", "msedge.exe", "firefox.exe", "Teams.exe", "OneDrive.exe")
| where InitiatingProcessFolderPath has_any ("\\Temp\\", "\\AppData\\", "\\Users\\Public\\")
or InitiatingProcessFileName in~ ("powershell.exe", "pwsh.exe", "cmd.exe", "wscript.exe", "cscript.exe", "mshta.exe", "rundll32.exe")
| summarize
ConnCount = count(),
RemoteIPs = make_set(RemoteIP, 10),
RemotePorts = make_set(RemotePort, 10)
by DeviceName, InitiatingProcessFileName, InitiatingProcessFolderPath, InitiatingProcessCommandLine
| order by ConnCount desc
DeviceName InitiatingProcessFileName InitiatingProcessFolderPath InitiatingProcessCommandLine ConnCount RemoteIPs RemotePorts
---------- ------------------------- --------------------------- ---------------------------- --------- --------- -----------
wkstn-eng-19 rundll32.exe C:\Windows\System32 rundll32.exe C:\Users\Public\pkg.dll,Run 48 ["198.51.100.72"] [443]
jq -r 'select(."id.resp_p" == 443 or ."id.resp_p" == 80 or ."id.resp_p" == 8443) |
[."id.orig_h", ."id.resp_h", (."id.resp_p" | tostring), (.service // "-")] | @tsv' conn.log | \
sort | uniq -c | sort -nr | head -n 20
184 10.10.24.55 198.51.100.72 443 ssl
72 10.10.14.22 93.184.216.34 443 ssl
15 10.10.19.08 203.0.113.99 8443 ssl
import json
import statistics
ts_list = []
with open("conn.log", encoding="utf-8") as f:
for line in f:
row = json.loads(line)
if row.get("id.orig_h") == "10.10.24.55" and row.get("id.resp_h") == "198.51.100.72":
ts_list.append(float(row["ts"]))
ts_list.sort()
intervals = [ts_list[i] - ts_list[i - 1] for i in range(1, len(ts_list))]
if intervals:
print("Samples:", len(intervals))
print("Mean interval (s):", round(statistics.mean(intervals), 2))
print("Min / Max (s):", round(min(intervals), 2), "/", round(max(intervals), 2))
Samples: 183
Mean interval (s): 60.14
Min / Max (s): 48.2 / 71.85
jq -r '[(.user_agent // "(empty)"), ."id.resp_h", (.host // "-")] | @tsv' http.log | \
sort | uniq -c | sort -nr | head -n 20
112 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 93.184.216.34 www.example.com
36 python-requests/2.31.0 203.0.113.99 sync-endpoint.example
9 (empty) 198.51.100.72 -
title: Script Interpreter Outbound Network Connection
id: 3c91a4e2-7b58-4d19-a612-8e4f2c901b77
status: experimental
description: Detects scripting or utility binaries initiating external network connections.
logsource:
product: windows
category: network_connection
detection:
selection:
Image|endswith:
- '\powershell.exe'
- '\pwsh.exe'
- '\wscript.exe'
- '\cscript.exe'
- '\mshta.exe'
- '\rundll32.exe'
condition: selection
falsepositives:
- Legitimate administrative scripts or software installers
level: medium
# Sigma / SIEM rule match:
Rule Title : Script Interpreter Outbound Network Connection (3c91a4e2-7b58-4d19-a612-8e4f2c901b77)
Host : wkstn-eng-19
Image : C:\Windows\System32\rundll32.exe
DestIP : 198.51.100.72:443
Severity : medium
DnsEvents
| where TimeGenerated > ago(24h)
| where strlen(Name) >= 45
| summarize
QueryCount = count(),
UniqueSubdomains = dcount(Name),
SampleQueries = make_set(Name, 5)
by ClientIP, Substring(Name, indexof(Name, ".") + 1)
| where QueryCount >= 20
| order by QueryCount desc
ClientIP DomainSuffix QueryCount UniqueSubdomains SampleQueries
-------- ------------ ---------- ---------------- -------------
10.10.15.88 sub.tunnel-test.example 94 94 ["7f8a9c2e4b6d1035a8c7e9b1d3f5a7c9.sub.tunnel-test.example"]
SELECT
Laddr.IP AS LocalIP,
Laddr.Port AS LocalPort,
Raddr.IP AS RemoteIP,
Raddr.Port AS RemotePort,
Status,
Pid,
ProcessName,
Exe
FROM artifact_call(artifact="Windows.Network.NetstatEnriched")
WHERE Status = "ESTABLISHED"
AND NOT Raddr.IP =~ "^(10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.|127\\.)"
LocalIP LocalPort RemoteIP RemotePort Status Pid ProcessName Exe
------- --------- -------- ---------- ------ --- ----------- ---
10.10.24.55 51422 198.51.100.72 443 ESTABLISHED 6844 rundll32.exe C:\Windows\System32\rundll32.exe
100700
Repeated outbound network events from $(srcip) within 5 minutes
T1071
** Alert 1795684102.31890: - local,c2_hunting,network_egress
2026 Nov 26 09:50:12 (wkstn-eng-19) 10.10.24.55->firewall
Rule: 100701 (level 10) -> 'Repeated outbound network events from 10.10.24.55 within 5 minutes'
ss -tupn state established
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp ESTAB 0 0 10.20.4.18:49210 198.51.100.72:443 users:(("python3",pid=8812,fd=4))
candidates = [
"198.51.100.72",
"198.51.100.72",
"sync-endpoint.example",
" SUB.TUNNEL-TEST.EXAMPLE "
]
cleaned = sorted({item.strip().lower() for item in candidates if item.strip()})
for indicator in cleaned:
print("Indicator:", indicator)
Indicator: 198.51.100.72
Indicator: sub.tunnel-test.example
Indicator: sync-endpoint.example
Select a C2 behavioral indicator below to review the telemetry signal, containment workflow, and fleet hunt steps: