T1046

Network Service Discovery

Adversaries may attempt to get a listing of services running on remote hosts and local network infrastructure devices, including those that may be vulnerable to remote software exploitation. Common methods include port, vulnerability, and wordlist scans using tools such as nmap, masscan, zmap, CrackMapExec, and custom port scanners. Within cloud environments, adversaries may discover services on other cloud hosts or connected on-premises systems. On macOS, adversaries may leverage Bonjour/mDNSResponder to discover advertised services. Threat actors including Volt Typhoon, APT39, BlackTech, menuPass, FIN13, and ransomware operators like BlackByte routinely perform network service discovery as part of internal reconnaissance before lateral movement.

Microsoft Sentinel / Defender
kusto
let ScanningTools = dynamic([
  "nmap", "masscan", "zmap", "netscan", "portscan", "superscan",
  "angryip", "advanced_ip_scanner", "advanced ip scanner",
  "tcping", "winegddrop", "bluetorch", "snsscan", "nbtscan",
  "netdiscover", "unicornscan", "rustscan"
]);
let ScanningCLIPatterns = dynamic([
  "-sS", "-sT", "-sU", "-sV", "-sn", "-p ", "--top-ports",
  "-A ", "--script", "--open", "-Pn",
  "scan", "--rate", "--ports",
  "/scan", "/p:"
]);
let NativeScanPatterns = dynamic([
  "net view", "net use\\\\", "netstat -an", "netstat -a",
  "arp -a", "route print",
  "Test-NetConnection", "TNC ", "Test-Connection",
  "1..254", "1..65535",
  "New-Object Net.Sockets.TcpClient", "System.Net.Sockets"
]);
let ScanningProcesses = dynamic([
  "nmap.exe", "masscan.exe", "zmap.exe", "netscan.exe",
  "tcping.exe", "superscan.exe", "angryipscan.exe",
  "nbtscan.exe", "nbtscan-unixwiz.exe", "winegddrop.exe"
]);
// Branch 1: Known scanning tool execution
let KnownScanners = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any (ScanningProcesses)
    or (ProcessCommandLine has_any (ScanningTools) and not ProcessCommandLine has_any ("update", "install", "help", "--version"))
| extend DetectionType = "KnownScanningTool"
| extend RiskIndicators = pack_array(
    iff(FileName has_any (ScanningProcesses), "KnownScannerBinary", ""),
    iff(ProcessCommandLine has "-sS" or ProcessCommandLine has "-sT", "SynOrTcpScan", ""),
    iff(ProcessCommandLine has "-sV" or ProcessCommandLine has "--script", "ServiceVersionProbe", ""),
    iff(ProcessCommandLine has "-p " or ProcessCommandLine has "--top-ports" or ProcessCommandLine has "--ports", "PortRangeSpecified", "")
  );
// Branch 2: Native tool / LOLBin scanning patterns
let NativeScanning = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("powershell.exe", "pwsh.exe", "cmd.exe")
    and ProcessCommandLine has_any (NativeScanPatterns)
| extend DetectionType = "NativeToolScanning"
| extend RiskIndicators = pack_array(
    iff(ProcessCommandLine has "1..254" or ProcessCommandLine has "1..65535", "LoopPortOrHostScan", ""),
    iff(ProcessCommandLine has "Net.Sockets", "DotNetSocketScan", ""),
    iff(ProcessCommandLine has "Test-NetConnection" or ProcessCommandLine has "TNC ", "TestNetConnection", ""),
    iff(ProcessCommandLine has "netstat", "ServiceEnumeration", "")
  );
// Combine and enrich
KnownScanners
| union NativeScanning
| extend IsInteractiveUser = AccountName !in~ ("SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE")
| extend InitiatingContext = strcat(InitiatingProcessFileName, " -> ", FileName)
| project Timestamp, DeviceName, AccountName, AccountDomain,
         FileName, ProcessCommandLine, InitiatingProcessFileName,
         InitiatingProcessCommandLine, InitiatingContext,
         DetectionType, RiskIndicators, IsInteractiveUser
| sort by Timestamp desc
medium severity high confidence

Data Sources

Process: Process Creation Command: Command Execution Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents

False Positives

  • Network engineers and IT administrators running nmap or AngryIP Scanner for authorized network inventory and asset discovery
  • Vulnerability management platforms (Nessus, Qualys, Rapid7 InsightVM agents) performing scheduled authenticated scans
  • Security operations teams running port scans during authorized penetration tests or purple team exercises
  • Monitoring tools using Test-NetConnection or netstat scripts to verify service availability and health checks
  • DevOps pipelines performing connectivity checks (Test-NetConnection, TCP client probes) during deployment validation

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections