Detection rules › Panther

Azure Network Security Configuration Modified or Deleted

Status
Experimental
Severity
medium
Log types
Azure.MonitorActivity
Tags
AZT506, Defense Evasion, Impact, Impair Defenses, Disable or Modify Cloud Firewall, Data Destruction
Reference
https://attack.mitre.org/techniques/T1562/007/
Source
github.com/panther-labs/panther-analysis

Identifies when a network security configuration is modified or deleted. This includes Network Security Group (NSG) changes, security rule modifications, NSG joins to subnets/interfaces, and diagnostic settings changes. These actions may indicate defense evasion, persistence, or preparation for data exfiltration.

MITRE ATT&CK coverage

Rule body yaml

AnalysisType: rule
Filename: azure_nsg_deleted_or_modified.py
RuleID: "Azure.MonitorActivity.Network.NSGModifiedOrDeleted"
DisplayName: "Azure Network Security Configuration Modified or Deleted"
Enabled: true
LogTypes:
  - Azure.MonitorActivity
Severity: Medium
Status: Experimental
Description: >
  Identifies when a network security configuration is modified or deleted.
  This includes Network Security Group (NSG) changes, security rule modifications, NSG joins to subnets/interfaces,
  and diagnostic settings changes. These actions may indicate defense evasion, persistence, or preparation for data exfiltration.
Reports:
  MITRE ATT&CK:
    - TA0005:T1562.007 # Defense Evasion: Impair Defenses - Disable or Modify Cloud Firewall
    - TA0040:T1485 # Impact: Data Destruction
Tags:
  - AZT506
  - Defense Evasion
  - Impact
  - Impair Defenses
  - Disable or Modify Cloud Firewall
  - Data Destruction
Runbook: |
  1. Find all network security group and firewall operations by the callerIpAddress in the 24 hours before and after this alert to identify if multiple security controls are being modified
  2. Query for all network configuration changes from the same caller in the past 7 days to determine if this is part of a broader defense evasion pattern
  3. Check if the callerIpAddress is associated with known VPNs or corporate network ranges used by authorized network administrators
Reference: https://attack.mitre.org/techniques/T1562/007/
SummaryAttributes:
  - resourceId
  - callerIpAddress
  - correlationId
Tests:
  - Name: NSG Deleted Successfully
    ExpectedResult: true
    Log:
      {
        "time": "2024-12-17T10:30:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkSecurityGroups/mynsg",
        "operationName": "Microsoft.Network/networkSecurityGroups/delete",
        "operationVersion": "2021-04-01",
        "category": "Administrative",
        "resultType": "Success",
        "resultSignature": "200",
        "callerIpAddress": "1.1.1.1",
        "correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "location": "",
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: NSG Modified
    ExpectedResult: true
    Log:
      {
        "time": "2024-12-17T13:30:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkSecurityGroups/mynsg",
        "operationName": "Microsoft.Network/networkSecurityGroups/write",
        "operationVersion": "2021-04-01",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "1.2.3.4",
        "correlationId": "d4e5f6a7-b8c9-0123-def0-333333333333",
        "location": "westus",
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: Security Rule Created
    ExpectedResult: true
    Log:
      {
        "time": "2024-12-17T14:00:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkSecurityGroups/mynsg/securityRules/AllowRDP",
        "operationName": "Microsoft.Network/networkSecurityGroups/securityRules/write",
        "operationVersion": "2021-04-01",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "4.4.4.4",
        "correlationId": "b2c3d4e5-f6a7-8901-bcde-f01234567890",
        "location": "westus",
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: Security Rule Deleted
    ExpectedResult: true
    Log:
      {
        "time": "2024-12-17T14:15:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkSecurityGroups/mynsg/securityRules/DenyAll",
        "operationName": "Microsoft.Network/networkSecurityGroups/securityRules/delete",
        "operationVersion": "2021-04-01",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "3.3.3.3",
        "correlationId": "c3d4e5f6-a7b8-9012-cdef-555555555555",
        "location": "eastus",
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: NSG Join Action
    ExpectedResult: true
    Log:
      {
        "time": "2024-12-17T14:30:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkSecurityGroups/mynsg",
        "operationName": "Microsoft.Network/networkSecurityGroups/join/action",
        "operationVersion": "2021-04-01",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "2.2.2.2",
        "correlationId": "d4e5f6a7-b8c9-0123-def0-444444444444",
        "location": "westus",
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: Diagnostic Settings Modified
    ExpectedResult: true
    Log:
      {
        "time": "2024-12-17T14:45:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkSecurityGroups/mynsg/providers/microsoft.insights/diagnosticSettings/default",
        "operationName": "Microsoft.Network/networkSecurityGroups/providers/microsoft.insights/diagnosticSettings/write",
        "operationVersion": "2021-04-01",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "1.1.1.1",
        "correlationId": "e5f6a7b8-c9d0-1234-ef01-333333333333",
        "location": "eastus",
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: Case Insensitive Match
    ExpectedResult: true
    Log:
      {
        "time": "2024-12-17T11:45:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/prod-rg/providers/Microsoft.Network/networkSecurityGroups/prodnsg",
        "operationName": "microsoft.network/networksecuritygroups/delete",
        "operationVersion": "2021-04-01",
        "category": "Administrative",
        "resultType": "Succeeded",
        "callerIpAddress": "1.2.3.4",
        "correlationId": "f9e8d7c6-b5a4-3210-9876-fedcba098765",
        "location": "eastus",
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: Different Operation
    ExpectedResult: false
    Log:
      {
        "time": "2024-12-17T15:15:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myresourcegroup/providers/Microsoft.Network/networkSecurityGroups/mynsg",
        "operationName": "Microsoft.Network/networkSecurityGroups/read",
        "operationVersion": "2021-04-01",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "25.26.27.28",
        "correlationId": "a7b8c9d0-e1f2-3456-0123-456789012345",
        "location": "eastus",
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }

Detection logic

Condition

operationName in ["MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/WRITE", "MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/DELETE", "MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/SECURITYRULES/WRITE", "MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/SECURITYRULES/DELETE", "MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/JOIN/ACTION", "MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/PROVIDERS/MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/WRITE"]
resultType in ["Success", "Succeeded"]

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
operationNamein
  • MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/DELETE
  • MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/JOIN/ACTION
  • MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/PROVIDERS/MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/WRITE
  • MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/SECURITYRULES/DELETE
  • MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/SECURITYRULES/WRITE
  • MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/WRITE
resultTypein
  • Succeeded
  • Success