| Attribute | Details | |—|—| | Technique ID | MISCONFIG-007 | | MITRE ATT&CK v18.1 | Cloud Service Discovery (T1526) | | Tactic | Discovery / Initial Access / Lateral Movement | | Platforms | Azure Virtual Network, Network Security Groups (NSG), Azure IaaS VMs, PaaS services | | Severity | Critical | | Technique Status | ACTIVE | | Last Verified | 2026-01-10 | | Affected Versions | All Azure subscriptions using NSGs for traffic filtering (all regions) | | Patched In | N/A – design allows broad rules; mitigated via proper NSG configuration, just‑in‑time access, and Azure Policy/Defender recommendations. | | Author | SERVTEP – Artur Pchelnikau |
Any or 0.0.0.0/0 (or Internet service tag) to sensitive ports (22/3389/1433/5985/5986, or *). Such rules effectively expose VMs and PaaS endpoints directly to the internet, bypassing perimeter controls and enabling scanning, brute‑force attacks, exploitation of unpatched services, and lateral movement. This misconfiguration is one of the most common and impactful in Azure environments.Source=*, SourcePort=*, Destination=*, DestPort=22/3389/*, Access=Allow.Allow from Any override the default deny‑all‑inbound rule and significantly expand the attack surface. Defender for Cloud has built‑in recommendations such as “All network ports should be restricted on network security groups associated to your virtual machine” and adaptive network hardening to detect and remediate such exposures.| Framework | Control / ID | Description |
|—|—|—|
| CIS Azure Foundations | AZURE 6.x – Network Security | Requires restricting NSG rules from allowing Any/0.0.0.0/0 to sensitive ports; implement least‑privilege network access. |
| DISA STIG | SRG‑NET‑000193 | Prohibits unrestricted inbound access; mandates firewall rules to restrict to authorized sources. |
| CISA SCuBA | Network Segmentation | Guidance for segmenting cloud networks and avoiding flat, internet‑exposed VNets. |
| NIST 800‑53 Rev5 | SC‑7, AC‑4, AC‑6 | Boundary protection and information flow enforcement; open NSGs violate least privilege and boundary safeguards. |
| GDPR | Art. 32 | Appropriate security including network controls; open management ports to the internet endanger personal data. |
| DORA | Art. 9 | Requires robust ICT security measures, including secure network configuration for critical financial workloads. |
| NIS2 | Art. 21 | Technical measures for risk management – includes segmentation and limiting exposure of critical systems. |
| ISO 27001:2022 | A.8.20, A.8.21 | Security of network services and network segregation. |
| ISO 27005 | “Publicly Exposed Management Interface” | Risk scenario: remote management exposed to the internet through misconfigured NSGs. |
Microsoft.Network/networkSecurityGroups/securityRules/write.Supported Versions:
All Azure NSG implementations for VNets, subnets, and NICs.
Tools:
az network nsg, az network nsg rule).Connect-AzAccount
Get-AzSubscription | ForEach-Object {
Set-AzContext -SubscriptionId $_.Id | Out-Null
Get-AzNetworkSecurityGroup | ForEach-Object {
$nsg = $_
$nsg.SecurityRules | Where-Object {
$_.Direction -eq 'Inbound' -and $_.Access -eq 'Allow' -and \
($_.SourceAddressPrefix -eq '0.0.0.0/0' -or $_.SourceAddressPrefix -eq 'Internet' -or $_.SourceAddressPrefix -eq '*')
} | Select-Object @{n='Subscription';e={$_.Id.Split('/')[-5]}},
@{n='NSG';e={$nsg.Name}}, Name, Priority,
SourceAddressPrefix, DestinationAddressPrefix,
DestinationPortRange, Protocol
}
} | Sort-Object Priority | Format-Table -AutoSize
What to Look For:
SourceAddressPrefix in (*, 0.0.0.0/0, Internet).DestinationPortRange set to sensitive management ports (22, 3389, 5985, 5986) or *.az network nsg list --query "[].{name:name, resourceGroup:resourceGroup, securityRules:securityRules}" -o json > nsgs.json
# Quick jq filter for open inbound rules
cat nsgs.json | jq '.[] | {name, resourceGroup,
openRules: (.securityRules[] | select(.direction=="Inbound" and .access=="Allow" and
(.sourceAddressPrefix=="*" or .sourceAddressPrefix=="0.0.0.0/0" or .sourceAddressPrefix=="Internet")))}'
Supported Versions: All Azure VNets/VMs with NSGs exposing management or application ports broadly.
Objective: Identify open NSG‑exposed ports on Azure public IPs.
Command (Attacker – Nmap):
nmap -Pn -p 22,80,443,3389,5985,5986 <public-ip-range>
Expected Output:
Any.Objective: Use exposed RDP/SSH/HTTP services for compromise.
Example:
What This Means:
Supported Versions: All Azure environments using NSGs.
Command (Azure CLI):
RG="rg-app"
NSG="nsg-web"
az network nsg rule create \
--resource-group $RG \
--nsg-name $NSG \
--name Allow-Any-RDP \
--priority 100 \
--access Allow \
--protocol Tcp \
--direction Inbound \
--source-address-prefixes 0.0.0.0/0 \
--source-port-ranges "*" \
--destination-port-ranges 3389 \
--destination-address-prefixes "*"
Expected Output:
References & Proofs:
No specific Atomic test exists for Azure NSG misconfiguration, but threat emulation can leverage:
Security teams can:
Install-Module Az.Network -Scope CurrentUser
Import-Module Az.Network
Get-AzNetworkSecurityGroup -Name "nsg-web" -ResourceGroupName "rg-app" |
Select-Object -ExpandProperty SecurityRules
az network nsg rule list --resource-group rg-app --nsg-name nsg-web -o table
Connect-AzAccount
Get-AzSubscription | ForEach-Object {
Set-AzContext -SubscriptionId $_.Id | Out-Null
Get-AzNetworkSecurityGroup | ForEach-Object {
$nsg = $_
$nsg.SecurityRules | Where-Object {
$_.Direction -eq 'Inbound' -and $_.Access -eq 'Allow' -and \
($_.SourceAddressPrefix -in @('*','0.0.0.0/0','Internet'))
} | Select-Object @{n='Subscription';e={$_.Id.Split('/')[-5]}},
@{n='NSG';e={$nsg.Name}}, Name, Priority,
SourceAddressPrefix, DestinationPortRange
}
}
Rule Configuration:
azure_activity.azure:activity.operationName, properties, resourceId.Any or 0.0.0.0/0.SPL Query:
index=azure_activity ResourceProviderValue="MICROSOFT.NETWORK" \
operationName="Microsoft.Network/networkSecurityGroups/securityRules/write"
| eval props = spath(_raw, "properties")
| eval ruleProps = spath(props, "properties")
| eval direction = spath(ruleProps, "direction"),
access = spath(ruleProps, "access"),
src = spath(ruleProps, "sourceAddressPrefix"),
src2 = spath(ruleProps, "sourceAddressPrefixes{}"),
destPort = spath(ruleProps, "destinationPortRange")
| where direction="Inbound" AND access="Allow" AND \
(src="*" OR src="0.0.0.0/0" OR src="Internet" OR like(src2, "%0.0.0.0/0%"))
| stats latest(_time) AS lastChange BY resourceId, src, destPort
What This Detects:
Source: Microsoft Defender for Cloud networking recommendations and Azure Policy definitions that identify overly permissive NSGs.
Rule Configuration:
AzureActivity.OperationNameValue, ResourceProviderValue, Properties, ResourceId.KQL Query:
AzureActivity
| where ResourceProviderValue == "MICROSOFT.NETWORK"
| where OperationNameValue == "MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/SECURITYRULES/WRITE"
| extend props = parse_json(Properties)
| extend rule = parse_json(tostring(props.responseBody.properties))
| extend direction = tostring(rule.direction),
access = tostring(rule.access),
src = tostring(rule.sourceAddressPrefix),
destPort = tostring(rule.destinationPortRange)
| where direction =~ "Inbound" and access =~ "Allow" and
(src in ("*","0.0.0.0/0","Internet"))
| project TimeGenerated, ResourceId, direction, access, src, destPort, Caller
What This Detects:
Source: Defender for Cloud networking recommendations – “All network ports should be restricted on network security groups associated to your virtual machine.”
Windows event logs are not directly involved in NSG evaluation, but:
Sysmon can help detect repeated failed inbound connections at the host and suspicious execution triggered by remote access.
Example:
Alert Names (examples):
Management ports of virtual machines should be protected with just-in-time network access control.
Manual Configuration Steps:
Not applicable directly; NSG configuration is logged in Azure Activity logs, not the M365 unified audit log. Use Sentinel/Log Analytics and Defender for Cloud for governance.
Any/0.0.0.0/0 with specific source IP ranges (corporate VPN, Bastion subnet, jump hosts).# Example: restrict RDP to Bastion subnet
$nsg = Get-AzNetworkSecurityGroup -Name "nsg-web" -ResourceGroupName "rg-app"
$rule = Get-AzNetworkSecurityRuleConfig -Name "Allow-Any-RDP" -NetworkSecurityGroup $nsg
$rule.SourceAddressPrefix = "10.0.10.0/24" # Bastion subnet
Set-AzNetworkSecurityGroup -NetworkSecurityGroup $nsg
0.0.0.0/0 to management ports.Connect-AzAccount
Get-AzSubscription | ForEach-Object {
Set-AzContext -SubscriptionId $_.Id | Out-Null
Get-AzNetworkSecurityGroup | ForEach-Object {
$nsg = $_
$open = $nsg.SecurityRules | Where-Object {
$_.Direction -eq 'Inbound' -and $_.Access -eq 'Allow' -and \
($_.SourceAddressPrefix -in @('*','0.0.0.0/0','Internet'))
}
if ($open) {
Write-Output "[!] Open inbound rules in $($nsg.Name) in subscription $($_.Id.Split('/')[-5])"
}
}
}
Expected Output (If Secure):
[!] lines; all NSGs have restricted inbound sources.| Step | Phase | Technique | Description |
|---|---|---|---|
| 1 | Discovery | T1526 – Cloud Service Discovery | Attacker enumerates public IPs and NSGs in Azure. |
| 2 | Initial Access | T1021 – Remote Services | Exploitation of exposed RDP/SSH services. |
| 3 | Current Step | MISCONFIG-007 – Open Network Security Groups | Misconfiguration enables direct access to internal workloads. |
| 4 | Lateral Movement | T1021/T1021.004 | Pivoting from compromised VMs to others. |
| 5 | Impact | DATA-EXFIL-XXX / IMPACT-XXX | Data theft or destructive actions once inside VNet. |