VPC Firewall Rules Allow Unrestricted Access to Management Ports

A VPC firewall 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

VPC firewall rules control which traffic reaches Compute Engine instances. Every VPC network has implied rules that deny all ingress and allow all egress, so inbound access exists only where a rule allows it. An ingress rule whose source range is 0.0.0.0/0 and whose ports include an administrative service exposes that service to the whole internet on every targeted instance that has an external IP address. The ports most often found are TCP 22 (SSH) and TCP 3389 (RDP), followed by WinRM 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 password, a leaked SSH private key or an unpatched vulnerability in the service gives an attacker interactive access to the instance and, from there, to the VPC network, the instance's attached service account 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.

A common cause is the default network that Compute Engine creates in new projects unless an organisation policy prevents it. It comes with pre-populated rules, including default-allow-ssh and default-allow-rdp, which allow TCP 22 and TCP 3389 from 0.0.0.0/0 to every instance in the network. Rules added during troubleshooting and never removed, and rules that target all instances rather than specific network tags or service accounts, are also common.

The exposure is identified by reviewing the firewall rules and hierarchical firewall policies that apply to each network, and confirmed by scanning the instances' external addresses from outside the organisation's network. Cloud posture tools report it as open SSH or RDP ports.

Remediation

  • Delete the rule, or restrict its source ranges to the specific addresses administrators connect from. On the default network, delete default-allow-ssh and default-allow-rdp, or delete the default network entirely once nothing depends on it.
  • Provide administrative access through Identity-Aware Proxy (IAP) TCP forwarding, which needs ingress only from IAP's address range, 35.235.240.0/20, and authorises each connection through IAM, so that instances need no external IP address for administration.
  • Remove external IP addresses from instances that do not need them, and restrict new ones with the constraints/compute.vmExternalIpAccess organisation policy constraint.
  • Prevent recurrence with hierarchical firewall policies at organisation or folder level that deny administrative ports from 0.0.0.0/0, and with the constraints/compute.skipDefaultNetworkCreation constraint for new projects.
  • Harden the services themselves: OS Login or key-based SSH authentication only, Network Level Authentication for RDP, and current patches.
gcloud compute firewall-rules delete default-allow-ssh default-allow-rdp gcloud compute firewall-rules create allow-ssh-from-iap --network="$NETWORK" --direction=INGRESS --action=ALLOW --rules=tcp:22 --source-ranges=35.235.240.0/20

Enable firewall rules logging on the administrative rules that remain, to record connections. Confirm the fix by reviewing the effective firewall rules for each instance and by scanning the external 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 Google Cloud Findings

Every Google Cloud finding