Security Groups Allow Unrestricted Access to Administrative Ports
Security group rules allow inbound connections from any internet address to administrative services such as SSH and RDP on AWS instances.
| Severity | High |
| CVSS 3.1 | 8.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.0 | 9.2 CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-668: Exposure of Resource to Wrong Sphere |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1133 External Remote Services, T1110 Brute Force |
| Category | Security Misconfiguration |
Description
One or more security groups allow inbound traffic from 0.0.0.0/0 or ::/0 to ports used for remote administration, typically SSH (TCP 22) and RDP (TCP 3389), and sometimes WinRM (TCP 5985 and 5986) or the management interfaces of other software. Rules allowing all ports or all protocols from anywhere have the same effect and are often found alongside them. Such rules are usually created for convenience during set-up, for administrators working from changing locations, or by launch wizards that offer to open SSH or RDP to anywhere, and then remain in place.
Where the group is attached to an instance or other resource with a public IP address, the service is reachable from the whole internet. Such exposed SSH and RDP services are quickly found by internet-wide scanning and are subjected to continual password guessing and credential stuffing. An attacker who guesses or reuses a valid password, holds a leaked SSH key, or exploits a vulnerability in the service gains interactive access to the instance, and from there to its data, to its IAM role credentials through the instance metadata service, and to other systems it can reach. The risk is greater where password authentication is enabled, the service software is out of date or the instance's IAM role is broad, and lower where only key-based authentication is accepted and the software is current.
The issue is identified by reviewing security group rules with aws ec2 describe-security-groups, together with the network interfaces they are attached to, and by scanning the public addresses from outside. Prowler, ScoutSuite, Security Hub and AWS Trusted Advisor all report unrestricted administrative ports.
Remediation
Remove internet-wide access to administrative ports:
- Use AWS Systems Manager Session Manager or EC2 Instance Connect Endpoint for administrative access. Neither needs inbound rules from the internet: Session Manager needs no inbound ports at all, authenticates users through IAM and can log sessions.
- Where direct SSH or RDP is still needed, restrict each rule's source to the organisation's VPN or bastion address ranges, or to a managed prefix list maintained for administrators, never
0.0.0.0/0or::/0. - Remove public IP addresses from instances that do not need them, and place them in private subnets.
- Prevent recurrence with AWS Config rules such as
restricted-sshandrestricted-common-ports, AWS Firewall Manager security group policies, or checks in infrastructure-as-code pipelines. - Harden the services themselves: key-based SSH authentication only, Network Level Authentication for RDP, and current patches.
Confirm the fix by reviewing the rules again and by scanning the instances' 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 trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.