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
DiscoveryT1046 Network Service Discovery

Rule body kusto

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

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
Src_IPcidr_match10.0.0.0/8
Src_IPcidr_match172.16.0.0/12
Src_IPcidr_match192.168.0.0/16

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Log_Typeeq
  • Firewall
dcount_Dst_Portgt
  • 50 transforms: cased

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
Src_IPsummarize