Active Scanning
This detection identifies inbound active reconnaissance scanning against your infrastructure by monitoring network perimeter logs for systematic port scanning, IP block sweeping, and vulnerability probing patterns originating from external sources. Because T1595 occurs pre-compromise and is directed at victim infrastructure from the outside, detection relies on perimeter telemetry such as firewall deny/drop logs, IDS/IPS alerts, and web server access logs rather than endpoint events. The detection correlates high-frequency blocked connection attempts from single source IPs across multiple destination ports or multiple destination hosts within short time windows, which is characteristic of automated scanning tools such as nmap, masscan, Shodan crawlers, and vulnerability scanners like Nessus or Qualys. Early identification of active scanning enables defenders to preemptively block attacker infrastructure before exploitation attempts begin.
CommonSecurityLog
| where TimeGenerated > ago(1h)
| where DeviceAction in~ ("Deny", "Drop", "Block", "Reject", "deny", "drop", "block", "reject")
| where isnotempty(SourceIP) and SourceIP !startswith "10." and SourceIP !startswith "192.168." and SourceIP !startswith "172."
| where DestinationPort > 0
| summarize
UniqueDestPorts = dcount(DestinationPort),
UniqueDestIPs = dcount(DestinationIP),
TotalAttempts = count(),
PortsTargeted = make_set(DestinationPort, 50),
FirstSeen = min(TimeGenerated),
LastSeen = max(TimeGenerated),
DeviceVendor = any(DeviceVendor),
DeviceProduct = any(DeviceProduct)
by SourceIP, bin(TimeGenerated, 5m)
| where UniqueDestPorts >= 10 or (UniqueDestIPs >= 5 and TotalAttempts >= 30)
| extend
ScanType = case(
UniqueDestPorts >= 20, "Aggressive Port Scan",
UniqueDestPorts >= 10, "Port Scan",
UniqueDestIPs >= 10, "IP Block Sweep",
UniqueDestIPs >= 5, "Limited IP Sweep",
"Suspicious Probe"
),
ScanDurationSeconds = datetime_diff('second', LastSeen, FirstSeen),
AttemptsPerMinute = TotalAttempts / max_of(datetime_diff('minute', LastSeen, FirstSeen), 1)
| project
TimeGenerated,
SourceIP,
ScanType,
UniqueDestPorts,
UniqueDestIPs,
TotalAttempts,
AttemptsPerMinute,
PortsTargeted,
ScanDurationSeconds,
FirstSeen,
LastSeen,
DeviceVendor,
DeviceProduct
| order by TotalAttempts desc Data Sources
Required Tables
False Positives
- Legitimate external vulnerability scanners operated by authorized third-party security vendors (e.g., Qualys, Tenable, Rapid7) running scheduled assessments — coordinate with security team to whitelist known scanner IPs
- Cloud provider health checks, CDN edge probes, and load balancer connectivity tests from cloud service IP ranges (AWS, Azure, Cloudflare) that generate denied traffic to closed ports
- Internet background radiation and automated internet-wide scanners from academic research institutions such as Shodan, Censys, and university security research groups hitting exposed public IPs
References (8)
- https://attack.mitre.org/techniques/T1595/
- https://attack.mitre.org/techniques/T1595/001/
- https://attack.mitre.org/techniques/T1595/002/
- https://attack.mitre.org/techniques/T1595/003/
- https://nmap.org/book/man.html
- https://github.com/robertdavidgraham/masscan
- https://cirt.net/Nikto2
- https://owasp.org/www-project-web-security-testing-guide/latest/6-Appendix/C-Fuzz_Vectors
Unlock Pro Content
Get the full detection package for T1595 including response playbook, investigation guide, and atomic red team tests.