T1583.007 Microsoft Sentinel · KQL

Detect Serverless in Microsoft Sentinel

Adversaries may purchase and configure serverless cloud infrastructure, such as Cloudflare Workers, AWS Lambda functions, or Google Apps Scripts, to use during operations. By routing command-and-control (C2) traffic through serverless platforms, adversaries blend malicious communications with legitimate cloud provider traffic. Traffic from infected endpoints appears to target known cloud provider domains (workers.dev, cloudfunctions.net, lambda-url.amazonaws.com), making it difficult to distinguish from ordinary SaaS or cloud API usage. The serverless runtime proxies requests to adversary-owned infrastructure while the cloud provider absorbs attribution complexity. Detection requires identifying beaconing behavior, non-browser processes connecting to serverless endpoints, and anomalous DNS query patterns to serverless platform domains.

MITRE ATT&CK

Tactic
Resource Development
Technique
T1583 Acquire Infrastructure
Sub-technique
T1583.007 Serverless
Canonical reference
https://attack.mitre.org/techniques/T1583/007/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
let ServerlessDomains = dynamic([
  "workers.dev", "pages.dev",
  "cloudfunctions.net",
  "lambda-url",
  "execute-api",
  "azurewebsites.net",
  "azurecontainerapps.io",
  "netlify.app",
  "vercel.app",
  "script.google.com"
]);
let SuspiciousProcesses = dynamic([
  "powershell.exe", "pwsh.exe", "cmd.exe",
  "wscript.exe", "cscript.exe", "mshta.exe",
  "rundll32.exe", "regsvr32.exe", "msbuild.exe",
  "python.exe", "python3.exe", "node.exe",
  "curl.exe", "wget.exe", "wmic.exe", "bitsadmin.exe"
]);
let BrowserProcesses = dynamic([
  "chrome.exe", "firefox.exe", "msedge.exe",
  "iexplore.exe", "opera.exe", "brave.exe", "vivaldi.exe"
]);
DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemoteUrl has_any (ServerlessDomains)
| where InitiatingProcessFileName !in~ (BrowserProcesses)
| extend IsSuspiciousProcess = InitiatingProcessFileName in~ (SuspiciousProcesses)
| extend ServerlessPlatform = case(
    RemoteUrl has "workers.dev" or RemoteUrl has "pages.dev", "Cloudflare Workers",
    RemoteUrl has "cloudfunctions.net", "Google Cloud Functions",
    RemoteUrl has "lambda-url" or RemoteUrl has "execute-api", "AWS Lambda/API Gateway",
    RemoteUrl has "azurewebsites.net" or RemoteUrl has "azurecontainerapps.io", "Azure Functions",
    RemoteUrl has "netlify.app", "Netlify Functions",
    RemoteUrl has "vercel.app", "Vercel Serverless",
    RemoteUrl has "script.google.com", "Google Apps Script",
    "Other Serverless"
  )
| project Timestamp, DeviceName, AccountName,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         InitiatingProcessParentFileName,
         RemoteUrl, RemoteIP, RemotePort,
         ServerlessPlatform, IsSuspiciousProcess
| sort by Timestamp desc
medium severity medium confidence

Detects non-browser processes making outbound connections to known serverless infrastructure platforms. Adversaries use Cloudflare Workers, AWS Lambda, Google Cloud Functions, and similar platforms as C2 proxies because traffic blends with legitimate cloud usage. This query identifies suspicious initiating processes (PowerShell, Python, cscript, curl, etc.) connecting to serverless domains — atypical for legitimate cloud service consumption from standard endpoints. Excludes browser processes to reduce noise from users visiting serverless-hosted web apps.

Data Sources

Network Traffic: Network Connection CreationMicrosoft Defender for EndpointDNS: DNS Query Resolution

Required Tables

DeviceNetworkEvents

False Positives & Tuning

  • Developer workstations running CI/CD scripts (Node.js, Python) that legitimately invoke AWS Lambda or Azure Functions APIs as part of build and test pipelines
  • IT automation tools using PowerShell or curl to call serverless-hosted webhook endpoints, monitoring heartbeats, or deployment triggers
  • Security scanning and vulnerability assessment tools probing cloud service APIs
  • Build agents and deployment pipeline runners (Jenkins agents, GitHub Actions self-hosted runners) making legitimate Lambda or Cloud Function calls
  • Monitoring agents and observability tools calling serverless-hosted status pages or synthetic monitoring endpoints
  • RPA (Robotic Process Automation) tools that interact with web services hosted on serverless platforms
Download portable Sigma rule (.yml)

Other platforms for T1583.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.

  1. Test 1PowerShell Beaconing to Cloudflare Workers Endpoint

    Expected signal: Sysmon Event ID 1: powershell.exe spawned with command line containing Invoke-WebRequest and the workers.dev URL. Sysmon Event ID 22: 5 DNS query events for df00tech-sentinel-test.argustest.workers.dev. Sysmon Event ID 3: 5 Network Connection events from powershell.exe to the Cloudflare IP on port 443. PowerShell ScriptBlock Log Event ID 4104 capturing the full loop script.

  2. Test 2Python Script Polling AWS Lambda Function URL

    Expected signal: Sysmon Event ID 1: python.exe (or python3.exe) process created with command line containing lambda-url and amazonaws.com. Sysmon Event ID 22: DNS query events for the Lambda URL subdomain (abcde12345fghij.lambda-url.us-east-1.amazonaws.com). Sysmon Event ID 3: Network connection events from python.exe to AWS IP ranges on port 443. Connections will fail with connection refused but process and DNS events fire.

  3. Test 3WScript Invoking Google Apps Script Web App (BlackWater Technique)

    Expected signal: Sysmon Event ID 1: cmd.exe spawning echo to create the .js file, then wscript.exe executing df00tech_gapps_test.js. Sysmon Event ID 11: File Create event for df00tech_gapps_test.js in %TEMP%. Sysmon Event ID 22: DNS query for script.google.com. Sysmon Event ID 3: Network connection from wscript.exe to Google IP on port 443 with DestinationHostname=script.google.com.

  4. Test 4cURL Beaconing to Google Cloud Function (Repeated Intervals)

    Expected signal: Sysmon Event ID 1: cmd.exe created with the for loop command, then curl.exe spawned 4 times as child processes with the cloudfunctions.net URL as an argument. Sysmon Event ID 22: DNS query events for us-central1-df00tech-argus-test.cloudfunctions.net. Sysmon Event ID 3: 4 Network Connection events from curl.exe to Google Cloud IP on port 443. Connections will return an error but process and DNS events fire regardless.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections