Detection rules › Kusto
Port Scan Detected
'This alert creates an incident when a source IP addresses attempt to communicate with a large amount of distinct ports within a short period.'
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Discovery |
Rule body
id: 427e4c9e-8cf4-4094-a684-a2d060dbca38
name: Port Scan Detected
description: |
'This alert creates an incident when a source IP addresses attempt to communicate with a large amount of distinct ports within a short period.'
severity: Medium
status: Available
requiredDataConnectors:
- connectorId: SyslogAma
datatypes:
- Syslog
queryFrequency: 1h
queryPeriod: 1h
triggerOperator: gt
triggerThreshold: 0
tactics:
- Discovery
relevantTechniques:
- T1046
query: |
let threshold = 50;
SophosXGFirewall
| where Log_Type =~ "Firewall"
| where not(ipv4_is_match("10.0.0.0",Src_IP,8) or ipv4_is_match("172.16.0.0",Src_IP,12) or ipv4_is_match("192.168.0.0",Src_IP,16))
| summarize dcount(Dst_Port) by Src_IP, bin(TimeGenerated, 5m)
| where dcount_Dst_Port > threshold
entityMappings:
- entityType: IP
fieldMappings:
- identifier: Address
columnName: Src_IP
version: 1.0.4
kind: Scheduled
Stages and Predicates
Parameters
let threshold = 50;
Stage 1: source
SophosXGFirewall
Stage 2: where
| where Log_Type =~ "Firewall"
Stage 3: where
| where not(ipv4_is_match("10.0.0.0",Src_IP,8) or ipv4_is_match("172.16.0.0",Src_IP,12) or ipv4_is_match("192.168.0.0",Src_IP,16))
Stage 4: summarize
| summarize dcount(Dst_Port) by Src_IP, bin(TimeGenerated, 5m)
Stage 5: where
| where dcount_Dst_Port > threshold
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
Src_IP | cidr_match | 10.0.0.0/8 | excludes:Src_IP field:"Src_IP" value:"10.0.0.0/8" |
Src_IP | cidr_match | 172.16.0.0/12 | excludes:Src_IP field:"Src_IP" value:"172.16.0.0/12" |
Src_IP | cidr_match | 192.168.0.0/16 | excludes:Src_IP field:"Src_IP" value:"192.168.0.0/16" |
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Log_Type | eq |
| field:"Log_Type" kind:eq value:"Firewall" |
dcount_Dst_Port | gt |
| field:"dcount_Dst_Port" kind:gt value:"50" |
Output fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
Src_IP | summarize |