id: azure-nsg-https-unrestricted info: name: Unrestricted HTTPS Access in Azure NSGs author: princechaddha severity: high description: | Ensure that Microsoft Azure network security groups (NSGs) do not allow unrestricted access on TCP port 443, used for HTTPS, to protect against unauthorized access and data breaches. impact: | Unrestricted access on TCP port 443 can expose sensitive data to interception and manipulation by malicious actors, potentially leading to significant security incidents. remediation: | Modify NSG rules to restrict access on TCP port 443. Only allow known IPs, and consider using advanced security measures such as Web Application Firewalls. reference: - https://docs.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview tags: cloud,devops,azure,microsoft,nsg,azure-cloud-config flow: | code(1); for (let NsgData of iterate(template.nsgdata)) { NsgData = JSON.parse(NsgData) set("nsg", NsgData.name) set("resourcegroup", NsgData.resourceGroup) code(2) } self-contained: true code: - engine: - sh - bash source: | az network nsg list --query '[*].{name:name, resourceGroup:resourceGroup}' --output json extractors: - type: json name: nsgdata internal: true json: - '.[]' - engine: - sh - bash source: | az network nsg rule list --nsg-name $nsg --resource-group $resourcegroup --query "[?direction=='Inbound' && access=='Allow' && protocol=='TCP' && (destinationPortRange=='443')]" matchers: - type: word words: - '"sourceAddressPrefix": "*"' - '"sourceAddressPrefix": "internet"' - '"sourceAddressPrefix": "any"' extractors: - type: dsl dsl: - 'nsg + " has unrestricted access on TCP port 443"' # digest: 490a004630440220717fc1cf322fa14ab850388028c035b234b963aad0bb6e8635928a5e7466d26a02204bc4a76648448bcd525845c8a10103a71335c8896e8012a295fb1b20b29ee005:922c64590222798bb761d5b6d8e72950