Network Security Group Allows Unrestricted Access to Management Ports

A network security group rule lets SSH, RDP or other administrative ports be reached from any internet address, exposing those services to password attacks and exploits.

SeverityHigh
CVSS 3.18.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Open in the calculator
CVSS 4.09.2 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator
CWECWE-668: Exposure of Resource to Wrong Sphere
OWASP Top 10A01:2025 Broken Access Control
MITRE ATT&CKT1133 External Remote Services, T1110 Brute Force
CategorySecurity Misconfiguration

Description

Network security groups (NSGs) filter traffic to Azure virtual machines and subnets. An inbound rule whose source is Any, 0.0.0.0/0 or the Internet service tag, and whose destination ports include an administrative service, exposes that service to the whole internet whenever the virtual machine has a public IP address or sits behind a load balancer rule that forwards the port. The ports most often found are TCP 22 (SSH) and TCP 3389 (RDP), followed by WinRM (TCP 5985 and 5986) and database ports.

Exposed SSH and RDP services are quickly found by internet-wide scanning and then face continuous password guessing, password spraying and credential stuffing. A weak or reused password, or an unpatched vulnerability in the service, gives an attacker interactive access to the virtual machine and, from there, to the virtual network, any managed identity assigned to the machine and other systems it can reach. The risk is lower where SSH accepts only keys, RDP requires Network Level Authentication with strong passwords and the services are fully patched, but every attacker on the internet still has an unrestricted opportunity to try.

Such rules often originate in the virtual machine creation wizard, where allowing selected public inbound ports creates a rule open to all source addresses, and are left in place after the initial set-up. An NSG can be associated with both a subnet and a network interface, and inbound traffic must be allowed by both, so the effective security rules of each network interface are what matter.

The exposure is identified by reviewing NSG rules or the effective security rules, and confirmed by scanning the public addresses from outside the organisation's network. Microsoft Defender for Cloud and cloud posture tools report it as management ports open to the internet.

Remediation

Remove internet-wide access to administrative ports:

  • Delete the rule, or restrict its source to the specific address ranges administrators connect from, such as the organisation's VPN egress addresses. Never use Any, 0.0.0.0/0 or Internet as the source for an administrative port.
  • Provide administrative access through Azure Bastion, which connects to virtual machines over their private addresses so that SSH and RDP need no public exposure, or through a VPN or ExpressRoute connection.
  • Where occasional direct access is unavoidable, use just-in-time VM access in Microsoft Defender for Cloud, which opens the port only to the requesting address and only for a limited time.
  • Remove public IP addresses from virtual machines that do not need them.
  • Prevent recurrence with Azure Policy and with checks in infrastructure-as-code pipelines that reject inbound rules allowing administrative ports from any source.
  • Harden the services themselves: key-based SSH authentication only, Network Level Authentication for RDP, strong unique passwords and current patches.

For example, to restrict an existing rule's source with the Azure CLI:

az network nsg rule update --resource-group "$RG" --nsg-name "$NSG" --name "$RULE" --source-address-prefixes "$ADMIN_RANGE"

Confirm the fix by reviewing the effective security rules of each network interface and by scanning the public addresses from outside the organisation's network, expecting the ports to be filtered.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Azure and Microsoft 365 Findings

Every Azure and Microsoft 365 finding