Detect Serverless in CrowdStrike LogScale
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.
MITRE ATT&CK
- Tactic
- Resource Development
- Technique
- T1584 Compromise Infrastructure
- Sub-technique
- T1584.007 Serverless
- Canonical reference
- https://attack.mitre.org/techniques/T1584/007/
LogScale Detection Query
// T1584.007 - Serverless C2 Beaconing Detection
// Requires: Network telemetry from Falcon sensor
#event_simpleName = "NetworkConnectIP4" OR #event_simpleName = "DnsRequest"
| eval serverless_domain = if(
DomainName = /(?i)(workers\.dev|cloudflareworkers\.com|execute-api\.[a-z0-9-]+\.amazonaws\.com|lambda-url\.[a-z0-9-]+\.amazonaws\.com|script\.google\.com|cloudfunctions\.net|\.run\.app|azurewebsites\.net|pages\.dev|netlify\.app|vercel\.app|supabase\.co|deno\.dev)/,
DomainName,
null()
)
| where isnotnull(serverless_domain)
| eval hour_bucket = formatTime("%Y-%m-%d %H", @timestamp)
| groupBy([ComputerName, ImageFileName, serverless_domain], function=[
count(aid, as=connection_count),
dcount(hour_bucket, as=hourly_buckets),
sum(BytesSent, as=total_bytes_sent),
sum(BytesReceived, as=total_bytes_received),
min(@timestamp, as=first_seen),
max(@timestamp, as=last_seen),
collect(ContextProcessId, as=pids)
])
| where connection_count >= 12 AND hourly_buckets >= 3
| eval avg_bytes_sent = total_bytes_sent / connection_count
| eval avg_bytes_received = total_bytes_received / connection_count
| eval avg_conn_per_hour = connection_count / hourly_buckets
| where avg_bytes_sent < 4096 AND avg_bytes_received < 16384 AND avg_conn_per_hour >= 2
| eval beaconing_likely = true()
| table([first_seen, last_seen, ComputerName, ImageFileName, serverless_domain, connection_count, hourly_buckets, avg_conn_per_hour, avg_bytes_sent, avg_bytes_received, pids])
| sort(connection_count, order=desc) CrowdStrike LogScale (CQL) query detecting serverless C2 beaconing via Falcon sensor telemetry. Filters NetworkConnectIP4 and DnsRequest events for known serverless cloud domains, groups by endpoint, process image, and destination, then applies beaconing heuristics: 12+ connections over 3+ hourly buckets with average payload sizes below 4KB sent and 16KB received per connection. Surfaces process image and PIDs for pivot investigation.
Data Sources
Required Tables
False Positives & Tuning
- Security tools and EDR agents themselves that communicate with cloud-hosted analysis backends or threat intel APIs on serverless infrastructure
- Developer endpoints with active cloud IDE plugins or remote development tools that poll AWS Lambda or Cloudflare Workers for code execution results
- Managed endpoint backup or sync clients that stage data through serverless intermediaries on a frequent schedule
Other platforms for T1584.007
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Simulate C2 Beacon to Cloudflare Workers Domain
Expected signal: DeviceNetworkEvents: 15 ConnectionSuccess events from PowerShell.exe to httpbin.org, spaced ~30 seconds apart. Sysmon Event ID 3: Network connections with consistent DestinationPort=443 and DestinationHostname=httpbin.org. Inter-arrival time analysis will show MeanInterval ~30 seconds with low standard deviation (JitterCoefficient < 0.05).
- Test 2Non-Browser Process Connecting to AWS Lambda URL
Expected signal: Sysmon Event ID 3: Network connections with Image=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe making POST requests to httpbin.org:443. DeviceNetworkEvents: InitiatingProcessFileName=powershell.exe, connection count=5 with small SentBytes values. Sysmon Event ID 22: DNS query for httpbin.org from powershell.exe.
- Test 3Enumerate and Test Unauthorized AWS Lambda Function (Controlled Lab)
Expected signal: AWS CloudTrail: ListFunctions and InvokeFunction API calls logged in CloudTrail with sourceIPAddress of the calling machine, userAgent=aws-cli, and requestParameters including the function name. If forwarded to a SIEM via CloudWatch/Kinesis, these appear in your cloud audit log index. EventName=InvokeFunction with errorCode absent indicates successful invocation.
- Test 4Deploy Test Cloudflare Worker via wrangler CLI (Simulates Infrastructure Compromise Foothold)
Expected signal: Cloudflare Audit Log: Worker script deployment event with actor email, source IP, and timestamp. If Cloudflare Logpush is configured to forward audit logs to your SIEM, the event appears as audit_log.action.type=deploy with resources referencing the worker name. Process telemetry: node.exe or cmd.exe spawning wrangler commands visible in Sysmon Event ID 1.
References (9)
- https://attack.mitre.org/techniques/T1584/007/
- https://www.bleepingcomputer.com/news/security/blackwater-malware-abuses-cloudflare-workers-for-c2-communication/
- https://blog.xpnsec.com/aws-lambda-redirector/
- https://awakesecurity.com/blog/threat-hunting-series-detecting-command-control-in-the-cloud/
- https://www.bleepingcomputer.com/news/security/hackers-abuse-google-apps-script-to-steal-credit-cards-bypass-csp/
- https://docs.aws.amazon.com/lambda/latest/dg/logging-using-cloudtrail.html
- https://developers.cloudflare.com/workers/observability/logging/
- https://cloud.google.com/logging/docs/audit/understanding-audit-logs
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1584.007/T1584.007.md
Unlock Pro Content
Get the full detection package for T1584.007 including response playbook, investigation guide, and atomic red team tests.