Detection rules › Kusto

Port Scan Detected

Status
available
Severity
medium
Time window
5m
Group by
Src_IP
Source
github.com/Azure/Azure-Sentinel

'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

TacticTechniques
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.

FieldKindExcluded valuesSearch
Src_IPcidr_match10.0.0.0/8excludes:Src_IP field:"Src_IP" value:"10.0.0.0/8"
Src_IPcidr_match172.16.0.0/12excludes:Src_IP field:"Src_IP" value:"172.16.0.0/12"
Src_IPcidr_match192.168.0.0/16excludes:Src_IP field:"Src_IP" value:"192.168.0.0/16"

Indicators

These rows show field, operator, and value matches.

Output fields

These fields are emitted when the rule matches.

FieldSource
Src_IPsummarize