nuclei-templates/cloud/azure/activitylog/azure-nsg-rule-update-unale...

59 lines
2.5 KiB
YAML
Raw Normal View History

2024-07-25 13:03:55 +00:00
id: azure-nsg-rule-update-unalerted
info:
name: Azure Network Security Group Rule Create/Update Alert Not Configured
author: princechaddha
severity: high
description: |
Ensure that an Azure activity log alert is fired whenever "Create" or "Update Network Security Group Rule" events are triggered within your Microsoft Azure cloud account. Activity log alerts get activated when a new activity log event that matches the condition specified in the alert occurs. In this case, the alert condition required is 'Whenever the Administrative Activity Log "Create or Update Security Rule (networkSecurityGroups/securityRules)" has "any" level, with "any" status and event is initiated by "any"'.
impact: |
Without proper alert rules configured for monitoring "Create or Update Network Security Group Rule" events, unauthorized or unwanted changes might go unnoticed, leading to potential security risks.
remediation: |
Ensure alert rules are properly configured to monitor and notify on "Create or Update Network Security Group Rule" events by setting the alert condition to "Microsoft.Network/networkSecurityGroups/securityRules/write" and ensuring that an action group is attached to manage notifications.
reference:
- https://docs.microsoft.com/en-us/azure/azure-monitor/platform/alerts-activity-log
tags: cloud,devops,azure,microsoft,network-security-group,azure-cloud-config
flow: |
code(1);
for (let AlertData of iterate(template.alertList)) {
set("nsg", AlertData);
code(2);
}
self-contained: true
code:
- engine:
- sh
- bash
source: |
az monitor activity-log alert list --output json --query '[?(enabled==`true`)].id'
extractors:
- type: json
name: alertList
internal: true
json:
- '.[]'
- engine:
- sh
- bash
source: |
az monitor activity-log alert show --ids "$nsg" --query 'condition'
matchers-condition: and
matchers:
- type: word
words:
- '"field": "operationName"'
- type: word
words:
- "Microsoft.Network/networkSecurityGroups/securityRules/write"
negative: true
extractors:
- type: dsl
dsl:
- 'nsg + " does not have the correct alert configuration for Create/Update Network Security Group Rule events"'
2024-09-12 05:59:14 +00:00
# digest: 4a0a00473045022006ddfa526f14feee14665b82fbe22b7b65ed2532e560c6d38c653ff84ab244da022100a9d7e4216ff666a1cd087d3c1c55a7f26c8f98eb24c8bea9c2709c832ab1d024:922c64590222798bb761d5b6d8e72950