A rule to ensure VPC security groups restrict SSH access from all source IPs.
Rule | VPC security groups should restrict ingress SSH access from 0.0.0.0/0 |
Framework | FedRAMP Low Revision 4 |
Severity | ✔ High |
Rule: VPC Security Groups Should Restrict Ingress SSH Access
Description
To comply with FedRAMP Low Revision 4 requirements, Amazon Virtual Private Cloud (VPC) security groups must restrict Secure Shell (SSH) ingress access to prevent unrestricted access from the internet (0.0.0.0/0). Security groups act as a virtual firewall for your instances to control inbound and outbound traffic. Restricting SSH access to known IP addresses reduces the potential attack surface for brute force attacks, SSH vulnerabilities, and other exploits.
Troubleshooting Steps
If a security group is improperly configured to allow SSH access from any IP address, the following troubleshooting steps can help identify and resolve the issue:
Identify Security Groups with Open SSH Access:
Review Security Group Associations:
Modify or Remove Unsafe Rules:
Remediation CLI Commands
Finding Security Groups with Open SSH Access
List security groups that allow ingress from 0.0.0.0/0 on port 22:
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.to-port,Values=22 Name=ip-permission.cidr,Values='0.0.0.0/0' --query 'SecurityGroups[*].[GroupId,GroupName]' --output text
Modifying or Removing Insecure SSH Access
Restrict SSH access to a specific IP address or range (replace
YOUR-SG-ID
with the actual security group ID and YOUR-IP-ADDRESS
with the specific IP or CIDR range):aws ec2 revoke-security-group-ingress --group-id YOUR-SG-ID --protocol tcp --port 22 --cidr 0.0.0.0/0 aws ec2 authorize-security-group-ingress --group-id YOUR-SG-ID --protocol tcp --port 22 --cidr YOUR-IP-ADDRESS
Alternatively, if using a network access control list (NACL) for additional security, ensure the NACLs similarly restrict SSH access from 0.0.0.0/0.
Step by Step Guide for Remediation
Repeat these steps for each security group that has an SSH rule open to the world.
By following these comprehensive steps and using the provided commands judiciously, you will ensure that your VPC security groups align with FedRAMP Low Revision 4 standards, thereby maintaining a robust security posture. This precise and actionable information is intended to be helpful and SEO-friendly, attracting individuals interested in cloud security best practices.