Scanning IP Blocks
Adversaries may scan victim IP blocks to gather information that can be used during targeting. Public IP addresses may be allocated to organizations by block, or a range of sequential addresses. Adversaries may scan IP blocks to gather victim network information, such as which IP addresses are actively in use as well as more detailed information about hosts assigned these addresses. Scans may range from simple pings (ICMP requests and responses) to more nuanced scans that may reveal host software/versions via server banners or other network artifacts. Information from these scans may reveal opportunities for other forms of reconnaissance, establishing operational resources, or gaining initial access.
// Branch 1: Inbound IP block scanning detected via perimeter firewall logs (CommonSecurityLog)
let ScanThresholdPorts = 20;
let ScanThresholdHosts = 15;
let WindowMinutes = 5;
CommonSecurityLog
| where TimeGenerated > ago(1h)
| where SourceIP !startswith "10."
and SourceIP !startswith "192.168."
and SourceIP !startswith "172.16."
and SourceIP !startswith "172.17."
and SourceIP !startswith "172.18."
and SourceIP !startswith "172.19."
and SourceIP !startswith "172.20."
and SourceIP !startswith "172.21."
and SourceIP !startswith "172.22."
and SourceIP !startswith "172.23."
and SourceIP !startswith "172.24."
and SourceIP !startswith "172.25."
and SourceIP !startswith "172.26."
and SourceIP !startswith "172.27."
and SourceIP !startswith "172.28."
and SourceIP !startswith "172.29."
and SourceIP !startswith "172.30."
and SourceIP !startswith "172.31."
and SourceIP !startswith "127."
and isnotempty(SourceIP)
| summarize
UniqueDestPorts = dcount(DestinationPort),
UniqueDestHosts = dcount(DestinationIP),
TotalConnections = count(),
DestinationPorts = make_set(DestinationPort, 50),
SampledDestHosts = make_set(DestinationIP, 20),
EarliestEvent = min(TimeGenerated),
LatestEvent = max(TimeGenerated),
DeviceVendor = any(DeviceVendor),
DeviceProduct = any(DeviceProduct)
by SourceIP, bin(TimeGenerated, WindowMinutes * 1m)
| where UniqueDestPorts >= ScanThresholdPorts or UniqueDestHosts >= ScanThresholdHosts
| extend ScanType = case(
UniqueDestHosts >= ScanThresholdHosts and UniqueDestPorts <= 5, "IP Block Sweep (ping/single-port)",
UniqueDestPorts >= ScanThresholdPorts and UniqueDestHosts <= 3, "Port Scan (single host)",
UniqueDestHosts >= ScanThresholdHosts and UniqueDestPorts >= ScanThresholdPorts, "Full Network Scan",
"Unknown Scan Pattern"
)
| extend ScanDurationSeconds = datetime_diff('second', LatestEvent, EarliestEvent)
| project TimeGenerated, SourceIP, ScanType, UniqueDestPorts, UniqueDestHosts,
TotalConnections, ScanDurationSeconds, DestinationPorts, SampledDestHosts,
DeviceVendor, DeviceProduct
| sort by UniqueDestHosts desc, UniqueDestPorts desc
// Branch 2: Scan tool execution on internal endpoints (lateral movement / compromised host pivot)
| union (
DeviceProcessEvents
| where Timestamp > ago(1h)
| where FileName in~ ("nmap", "nmap.exe", "masscan", "masscan.exe", "zmap", "unicornscan",
"hping3", "hping3.exe", "netdiscover", "fping", "fping.exe",
"angry_ip_scanner.exe", "ipscan.exe", "advanced_ip_scanner.exe")
or ProcessCommandLine has_any ("nmap ", "masscan ", "--scan-delay", "-sS ", "-sT ",
"-sV ", "-sn ", "-Pn ", "--open ", "-p- ",
"port-scan", "portscan")
| extend ScanType = "Scan Tool Executed on Endpoint"
| extend SourceIP = ""
| extend UniqueDestPorts = int(null)
| extend UniqueDestHosts = int(null)
| extend TotalConnections = int(null)
| extend ScanDurationSeconds = int(null)
| extend DestinationPorts = dynamic([])
| extend SampledDestHosts = dynamic([])
| extend DeviceVendor = ""
| extend DeviceProduct = ""
| project TimeGenerated=Timestamp, SourceIP=DeviceName, ScanType,
UniqueDestPorts, UniqueDestHosts, TotalConnections, ScanDurationSeconds,
DestinationPorts, SampledDestHosts, DeviceVendor, DeviceProduct,
AccountName, ProcessCommandLine, InitiatingProcessFileName
) Data Sources
Required Tables
False Positives
- Authorized vulnerability scanners (Qualys, Tenable Nessus, Rapid7 InsightVM) running scheduled scans from dedicated scanner IPs — allowlist scanner IP ranges
- Internet-wide scanning services (Shodan, Censys, Binaryedge, Shadowserver) continuously scan public IPs and will trigger high-volume alerts — maintain an allowlist of known scanner AS numbers
- Internal IT asset discovery tools (SCCM network discovery, ManageEngine, Spiceworks) scanning internal subnets — scope detection to exclude known management VLAN source IPs
- Load balancer health checks and monitoring systems (Pingdom, Datadog Synthetics, AWS ELB probes) that repeatedly probe multiple ports on registered hosts
- Red team engagements and authorized penetration tests — coordinate with security team to suppress alerts during test windows
References (10)
- https://attack.mitre.org/techniques/T1595/001/
- https://www.caida.org/publications/papers/2012/analysis_slash_zero/analysis_slash_zero.pdf
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa24-249a
- https://www.trendmicro.com/en_us/research/21/i/teamtnt-targets-aws-and-alibaba-cloud.html
- https://nmap.org/book/man-port-scanning-techniques.html
- https://github.com/robertdavidgraham/masscan
- https://learn.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-overview
- https://learn.microsoft.com/en-us/azure/sentinel/data-connectors/common-event-format
- https://docs.zeek.org/en/master/logs/conn.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1595.001/T1595.001.md
Unlock Pro Content
Get the full detection package for T1595.001 including response playbook, investigation guide, and atomic red team tests.