Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Port Scan Detected

Back
Id427e4c9e-8cf4-4094-a684-a2d060dbca38
RulenamePort Scan Detected
DescriptionThis alert creates an incident when a source IP addresses attempt to communicate with a large amount of distinct ports within a short period.
SeverityMedium
TacticsDiscovery
TechniquesT1046
Required data connectorsSophosXGFirewall
SyslogAma
KindScheduled
Query frequency1h
Query period1h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Sophos XG Firewall/Analytic Rules/PortScanDetected.yaml
Version1.0.3
Arm template427e4c9e-8cf4-4094-a684-a2d060dbca38.json
Deploy To Azure
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
relevantTechniques:
- T1046
name: Port Scan Detected
requiredDataConnectors:
- dataTypes:
  - Syslog
  connectorId: SophosXGFirewall
- datatypes:
  - Syslog
  connectorId: SyslogAma
entityMappings:
- fieldMappings:
  - identifier: Address
    columnName: Src_IP
  entityType: IP
triggerThreshold: 0
id: 427e4c9e-8cf4-4094-a684-a2d060dbca38
tactics:
- Discovery
version: 1.0.3
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Sophos XG Firewall/Analytic Rules/PortScanDetected.yaml
queryPeriod: 1h
kind: Scheduled
queryFrequency: 1h
severity: Medium
status: Available
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.'
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  
triggerOperator: gt
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2024-01-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/427e4c9e-8cf4-4094-a684-a2d060dbca38')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/427e4c9e-8cf4-4094-a684-a2d060dbca38')]",
      "properties": {
        "alertRuleTemplateName": "427e4c9e-8cf4-4094-a684-a2d060dbca38",
        "customDetails": null,
        "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.'\n",
        "displayName": "Port Scan Detected",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "Src_IP",
                "identifier": "Address"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Sophos XG Firewall/Analytic Rules/PortScanDetected.yaml",
        "query": "let threshold = 50;\nSophosXGFirewall\n| where Log_Type =~ \"Firewall\"\n| 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))\n| summarize dcount(Dst_Port) by Src_IP, bin(TimeGenerated, 5m)\n| where dcount_Dst_Port > threshold\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "PT1H",
        "severity": "Medium",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Discovery"
        ],
        "techniques": [
          "T1046"
        ],
        "templateVersion": "1.0.3",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}