T1584.007

Serverless

Adversaries may compromise serverless cloud infrastructure, such as Cloudflare Workers, AWS Lambda functions, or Google Apps Scripts, to proxy command-and-control (C2) communications between implants on victim systems and adversary-controlled backend servers. Because traffic destined for compromised serverless functions originates from subdomains of trusted cloud providers (e.g., *.workers.dev, *.execute-api.amazonaws.com, script.google.com), network-layer defenses relying on domain or IP reputation are largely ineffective. Detection pivots to behavioral analysis of victim-side telemetry: identifying processes on endpoints communicating with serverless platforms in patterns consistent with C2 beaconing (periodic connections, low-variance timing, small symmetric payloads), correlating process context with destination domains, and monitoring cloud audit logs for unauthorized modifications to serverless functions within environments the defender controls.

Microsoft Sentinel / Defender
kusto
let BeaconLookback = 24h;
let MinHourlyBuckets = 3;
let MinTotalConnections = 12;
let ServerlessDomains = dynamic([
    "workers.dev",
    "cloudflareworkers.com",
    "execute-api.amazonaws.com",
    "lambda-url",
    "script.google.com",
    "cloudfunctions.net",
    "run.app",
    "azurewebsites.net",
    "pages.dev",
    "netlify.app",
    "vercel.app",
    "supabase.co",
    "deno.dev"
]);
let SuspiciousParents = dynamic([
    "cmd.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe",
    "mshta.exe", "rundll32.exe", "regsvr32.exe", "svchost.exe"
]);
DeviceNetworkEvents
| where Timestamp > ago(BeaconLookback)
| where RemoteUrl has_any (ServerlessDomains)
| where ActionType == "ConnectionSuccess"
| extend HourBucket = bin(Timestamp, 1h)
| summarize
    TotalConnections = count(),
    HourlyBuckets = dcount(HourBucket),
    TotalBytesSent = sum(SentBytes),
    TotalBytesReceived = sum(ReceivedBytes),
    RemotePorts = make_set(RemotePort, 10),
    FirstSeen = min(Timestamp),
    LastSeen = max(Timestamp)
    by DeviceName, RemoteUrl, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName
| where TotalConnections >= MinTotalConnections
| where HourlyBuckets >= MinHourlyBuckets
| extend AvgConnectionsPerHour = round(toreal(TotalConnections) / toreal(HourlyBuckets), 1)
| extend AvgBytesSentPerConn = iif(TotalConnections > 0, TotalBytesSent / TotalConnections, 0)
| extend AvgBytesReceivedPerConn = iif(TotalConnections > 0, TotalBytesReceived / TotalConnections, 0)
// Beaconing signature: high frequency, small symmetric payloads
| extend BeaconingLikely = (AvgBytesSentPerConn < 4096 and AvgBytesReceivedPerConn < 16384 and AvgConnectionsPerHour >= 2)
| extend SuspiciousInitiator = InitiatingProcessFileName has_any (SuspiciousParents)
| where BeaconingLikely or SuspiciousInitiator
| project
    FirstSeen,
    LastSeen,
    DeviceName,
    InitiatingProcessAccountName,
    InitiatingProcessFileName,
    InitiatingProcessCommandLine,
    RemoteUrl,
    TotalConnections,
    HourlyBuckets,
    AvgConnectionsPerHour,
    AvgBytesSentPerConn,
    AvgBytesReceivedPerConn,
    BeaconingLikely,
    SuspiciousInitiator,
    RemotePorts
| sort by TotalConnections desc
high severity medium confidence

Data Sources

Network Traffic: Network Connection Creation Microsoft Defender for Endpoint DeviceNetworkEvents

Required Tables

DeviceNetworkEvents

False Positives

  • Legitimate SaaS applications with serverless backends making regular telemetry or heartbeat calls (e.g., Datadog agents, monitoring tools with serverless collectors)
  • Developer workstations running applications that actively use serverless functions for legitimate business logic (API calls, webhook endpoints)
  • Browser-based applications using Cloudflare Workers or Vercel edge functions for content delivery, API proxying, or authentication flows
  • IT automation tools and deployment pipelines (GitHub Actions, CI/CD runners) communicating with serverless orchestration backends
  • Security tools and EDR agents that may communicate with cloud-hosted processing functions for telemetry or rule updates

Unlock Pro Content

Get the full detection package for T1584.007 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections