T1018 Microsoft Sentinel · KQL

Detect Remote System Discovery in Microsoft Sentinel

Adversaries may attempt to get a listing of other systems by IP address, hostname, or other logical identifier on a network that may be used for Lateral Movement from the current system. Common methods include net view, ping sweeps, ARP cache enumeration, NBT/NetBIOS scanning, and third-party tools such as Nmap, MASSCAN, NBTscan, and Angry IP Scanner. Adversaries may also read local host files (C:\Windows\System32\Drivers\etc\hosts or /etc/hosts) or query Active Directory for computer objects. On ESXi hosts, esxcli commands may be used to enumerate network peers.

MITRE ATT&CK

Tactic
Discovery
Technique
T1018 Remote System Discovery
Canonical reference
https://attack.mitre.org/techniques/T1018/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
let NetworkDiscoveryProcesses = dynamic(["net.exe", "net1.exe", "ping.exe", "arp.exe", "nbtstat.exe", "nltest.exe", "nmap", "masscan", "nbtscan", "ipscan"]);
let SuspiciousCommandPatterns = dynamic(["net view", "net1 view", "/domain", "net group", "nltest /dclist", "nltest /dsgetdc", "nltest /domain_trusts", "arp -a", "nbtstat -A", "nbtstat -a"]);
let PingSweepPattern = dynamic(["-n 1", "/c ping", "for /l", "1..254", "Test-Connection", "Test-NetConnection", "System.Net.NetworkInformation.Ping"]);
// Branch 1: Known network discovery tools and commands
let Branch1 = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ (NetworkDiscoveryProcesses)
    or ProcessCommandLine has_any (SuspiciousCommandPatterns)
| extend DiscoveryType = case(
    ProcessCommandLine has "net view" or ProcessCommandLine has "net1 view", "NetView",
    ProcessCommandLine has "nltest", "DomainDiscovery",
    ProcessCommandLine has "arp -a" or ProcessCommandLine has "arp /a", "ARPCache",
    ProcessCommandLine has "nbtstat", "NetBIOS",
    FileName =~ "ping.exe" and ProcessCommandLine has_any ("-n 1", "/c"), "PingSweep",
    FileName =~ "nmap" or FileName =~ "masscan" or FileName =~ "nbtscan", "ExternalScanner",
    "Other"
  );
// Branch 2: PowerShell-based ping sweeps and AD computer enumeration
let Branch2 = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine has_any (PingSweepPattern)
    or ProcessCommandLine has_any ("Get-ADComputer", "Get-NetComputer", "Invoke-Portscan", "netscan", "NetworkInformation.Ping", "Resolve-DnsName", "[Net.Dns]::GetHostEntry", "ping -n 1")
| extend DiscoveryType = case(
    ProcessCommandLine has_any ("Get-ADComputer", "Get-NetComputer"), "ADComputerEnum",
    ProcessCommandLine has_any ("NetworkInformation.Ping", "Test-Connection", "Test-NetConnection"), "PSPingSweep",
    ProcessCommandLine has_any ("Invoke-Portscan", "netscan"), "PSPortScan",
    "PSNetworkDiscovery"
  );
// Branch 3: hosts file access (passive discovery)
let Branch3 = DeviceFileEvents
| where Timestamp > ago(24h)
| where FolderPath =~ @"C:\Windows\System32\drivers\etc"
| where FileName =~ "hosts"
| where InitiatingProcessFileName !in~ ("svchost.exe", "MsMpEng.exe", "csrss.exe")
| extend DiscoveryType = "HostsFileAccess";
union Branch1, Branch2
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine, DiscoveryType
| sort by Timestamp desc
medium severity medium confidence

Detects remote system discovery activity using Microsoft Defender for Endpoint DeviceProcessEvents and DeviceFileEvents tables. Covers three branches: (1) native Windows tools such as net view, nltest, arp, nbtstat, and third-party scanners; (2) PowerShell-based techniques including Get-ADComputer, System.Net.NetworkInformation.Ping ping sweeps, Test-Connection, and PowerView's Get-NetComputer; (3) hosts file reads by unexpected processes. DiscoveryType field categorises the method for analyst triage.

Data Sources

Process: Process CreationCommand: Command ExecutionFile: File AccessMicrosoft Defender for Endpoint

Required Tables

DeviceProcessEventsDeviceFileEvents

False Positives & Tuning

  • IT helpdesk and system administrators running net view or ping sweeps for legitimate troubleshooting
  • Network monitoring tools (PRTG, SolarWinds, Nagios, Zabbix) that periodically ping or enumerate hosts
  • Software deployment systems (SCCM, Ansible, Puppet) that query AD for computer objects via Get-ADComputer
  • Vulnerability scanning tools (Tenable Nessus, Qualys, Rapid7) running credentialed scans from authorised scanner hosts
  • Domain controllers running nltest for replication health checks
Download portable Sigma rule (.yml)

Other platforms for T1018


Testing Methodology

Validate this detection against 5 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 1Net View Domain Enumeration

    Expected signal: Sysmon Event ID 1: Process Create for net.exe with CommandLine='net view /domain' and then 'net view'. Security Event ID 4688 (if command-line auditing enabled). Sysmon Event ID 3 may show NetBIOS/SMB connections to contacted hosts on port 137/445.

  2. Test 2Ping Sweep of Local Subnet

    Expected signal: Up to 254 Sysmon Event ID 1 events for ping.exe, each with a different target IP in CommandLine. Sysmon Event ID 11 for file creation of df00tech-sweep.txt. Network ICMP traffic visible in NetFlow/packet capture. File creation in TEMP directory.

  3. Test 3PowerShell Get-ADComputer Enumeration

    Expected signal: Sysmon Event ID 1: powershell.exe with CommandLine containing 'Get-ADComputer'. PowerShell ScriptBlock Log Event ID 4104 with full script. LDAP traffic from the host to domain controller on port 389/636. Sysmon Event ID 11 for CSV file creation in TEMP directory.

  4. Test 4ARP Cache Enumeration

    Expected signal: Sysmon Event ID 1: arp.exe with CommandLine='arp -a'. Security Event ID 4688 (if command-line auditing enabled). No network events generated — this is a purely local operation. Sysmon Event ID 11 for file creation of df00tech-arp.txt.

  5. Test 5NLTest Domain Trust and DC Discovery

    Expected signal: Sysmon Event ID 1: nltest.exe with CommandLine containing '/dclist:' and '/domain_trusts'. Security Event ID 4688 (if command-line auditing enabled). DNS queries for _ldap._tcp.dc._msdcs.<domain> visible in DNS logs.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections