Compromise Infrastructure: Server
Adversaries may compromise third-party servers to stage, launch, and execute operations. Rather than purchasing dedicated infrastructure, threat actors hijack legitimate servers — including web servers, mail servers, and application servers — to host malware, serve as command-and-control nodes, support phishing campaigns, or enable watering hole attacks. Because the compromised servers are legitimately owned by third parties, traffic to and from them may blend in with normal business activity. Real-world examples include Lazarus Group staging malware on compromised servers, Volt Typhoon using compromised PRTG monitoring servers for C2, Sandworm compromising EXIM mail servers for campaign infrastructure, and Dragonfly leveraging legitimate websites to host C2 and malware modules.
// T1584.004 — Compromise Infrastructure: Server
// Strategy: correlate outbound connections against threat intelligence,
// detect C2 beaconing patterns, and flag connections to known compromised server ranges.
// Requires Microsoft Sentinel with ThreatIntelligenceIndicator table populated.
let LookbackPeriod = 24h;
let BeaconMinConnections = 5;
let BeaconMinIntervalMin = 1;
let BeaconMaxIntervalMin = 120;
// Pull active TI indicators for IP-based indicators
let ThreatIntelServerIPs = ThreatIntelligenceIndicator
| where TimeGenerated > ago(30d)
| where Active == true
| where isnotempty(NetworkIP)
| where ConfidenceScore >= 50
| distinct NetworkIP, Description, ThreatType;
// Pull active TI indicators for domain-based indicators
let ThreatIntelDomains = ThreatIntelligenceIndicator
| where TimeGenerated > ago(30d)
| where Active == true
| where isnotempty(DomainName)
| where ConfidenceScore >= 50
| distinct DomainName, Description, ThreatType;
// Detection Branch 1: Direct TI IP hit on outbound connections
let TIIPHits = DeviceNetworkEvents
| where Timestamp > ago(LookbackPeriod)
| where ActionType in ("ConnectionSuccess", "ConnectionAttempt", "InboundConnectionAccepted")
| join kind=inner ThreatIntelServerIPs on $left.RemoteIP == $right.NetworkIP
| extend DetectionMethod = "ThreatIntel-IP"
| project Timestamp, DeviceName, AccountName = InitiatingProcessAccountName,
InitiatingProcessFileName, InitiatingProcessCommandLine,
RemoteIP, RemotePort, RemoteUrl,
ThreatDescription = Description, ThreatType,
DetectionMethod;
// Detection Branch 2: DNS-resolved TI domain hits
let TIDomainHits = DeviceNetworkEvents
| where Timestamp > ago(LookbackPeriod)
| where isnotempty(RemoteUrl)
| extend RequestedDomain = tostring(parse_url(RemoteUrl).Host)
| join kind=inner ThreatIntelDomains on $left.RequestedDomain == $right.DomainName
| extend DetectionMethod = "ThreatIntel-Domain"
| project Timestamp, DeviceName, AccountName = InitiatingProcessAccountName,
InitiatingProcessFileName, InitiatingProcessCommandLine,
RemoteIP, RemotePort, RemoteUrl,
ThreatDescription = Description, ThreatType,
DetectionMethod;
// Detection Branch 3: Beaconing pattern — periodic connections to same external IP
let BeaconingHosts = DeviceNetworkEvents
| where Timestamp > ago(LookbackPeriod)
| where RemoteIPType == "Public"
| where ActionType == "ConnectionSuccess"
| summarize ConnectionCount = count(),
FirstSeen = min(Timestamp),
LastSeen = max(Timestamp),
Ports = make_set(RemotePort, 10)
by DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine, RemoteIP
| where ConnectionCount >= BeaconMinConnections
| extend SpanMinutes = datetime_diff('minute', LastSeen, FirstSeen)
| where SpanMinutes > 10
| extend AvgIntervalMinutes = toreal(SpanMinutes) / toreal(ConnectionCount - 1)
| where AvgIntervalMinutes between (BeaconMinIntervalMin .. BeaconMaxIntervalMin)
| extend DetectionMethod = "BeaconingPattern"
| project FirstSeen, LastSeen, DeviceName, AccountName = "",
InitiatingProcessFileName, InitiatingProcessCommandLine,
RemoteIP, RemotePort = tostring(Ports),
RemoteUrl = "",
ThreatDescription = strcat("Beaconing: ", tostring(ConnectionCount), " connections over ", tostring(SpanMinutes), " min, avg interval ", round(AvgIntervalMinutes, 1), " min"),
ThreatType = "C2-Beacon",
DetectionMethod
| project-rename Timestamp = FirstSeen;
// Union all branches
union TIIPHits, TIDomainHits, BeaconingHosts
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- Legitimate software update services or CDN endpoints that have been flagged as TI hits due to shared IP space with previously malicious infrastructure
- Monitoring and telemetry agents (Datadog, Dynatrace, Splunk UF, PRTG) that beacon home at regular intervals, triggering the beaconing pattern branch
- Business applications with regular API polling (CRM sync, ERP integrations, health check daemons) creating periodic connection patterns that resemble C2 beaconing
- Cloud provider metadata endpoints or service discovery mechanisms that appear as repeated connections to the same external IP
- False TI hits from third-party threat feeds with low-quality indicators — particularly providers that add entire cloud provider IP ranges or CDN prefixes
References (10)
- https://attack.mitre.org/techniques/T1584/004/
- https://www.trendmicro.com/content/dam/trendmicro/global/en/research/22/a/earth-lusca-employs-sophisticated-infrastructure-varied-tools-and-techniques/technical-brief-delving-deep-an-analysis-of-earth-lusca-operations.pdf
- https://michaelkoczwara.medium.com/cobalt-strike-c2-hunting-with-shodan-c448d501a6e2
- https://cloud.google.com/blog/topics/threat-intelligence/scandalous-external-detection-using-network-scan-data-and-automation/
- https://threatconnect.com/blog/infrastructure-research-hunting/
- https://www.secureworks.com/research/bronze-silhouette
- https://media.defense.gov/2020/Feb/20/2002315240/-1/-1/0/CSA-Sandworm-Actors-Exploiting-Vulnerability-in-Exim-Transfer-Agent-20200520.PDF
- https://learn.microsoft.com/en-us/azure/sentinel/understand-threat-intelligence
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkevents-table
- https://docs.splunk.com/Documentation/CIM/latest/User/NetworkTraffic
Unlock Pro Content
Get the full detection package for T1584.004 including response playbook, investigation guide, and atomic red team tests.