This rule ensures VPC security groups restrict access on specific common ports from all sources.
Rule | VPC security groups should restrict ingress access on ports 20, 21, 22, 3306, 3389, 4333 from 0.0.0.0/0 |
Framework | AWS Audit Manager Control Tower Guardrails |
Severity | ✔ High |
VPC Security Groups: Restrict Ingress Access
Amazon Web Services (AWS) security groups act as a virtual firewall for EC2 instances to control inbound and outbound traffic. To enhance security, certain ports should not be exposed to the worldwide internet, represented by the CIDR block
0.0.0.0/0
. This guide details steps to restrict ingress access on vulnerable ports within a VPC security group, as required by AWS Audit Manager Control Tower Guardrails.Description of the Rule
Security groups in AWS VPC should have restrictions to prevent unrestricted access to specific ports that are commonly targeted for exploitation:
Ingress traffic coming from
0.0.0.0/0
to these ports should be prohibited to prevent unauthorized access, data breaches, or other security incidents.Troubleshooting Steps
If you suspect that your security groups are misconfigured, follow these steps:
Review Security Group Rules
Assess Ingress Rules
0.0.0.0/0
Remediation Steps
To change the ingress rules, you can use either the AWS Management Console or the AWS CLI.
Using the AWS Management Console
Using the AWS CLI
For each port that needs to be restricted, the following commands can be used to revoke the problematic rule:
aws ec2 revoke-security-group-ingress --group-id sg-xxxxxx --protocol tcp --port <PORT_NUMBER> --cidr 0.0.0.0/0
Replace
sg-xxxxxx
with the security group ID and <PORT_NUMBER>
with the actual port that needs to be restricted.Repeat this command for ports 20, 21, 22, 3306, 3389, and 4333.
Verification Step
Once you have updated your rules, verify the changes:
aws ec2 describe-security-groups --group-ids sg-xxxxxx
0.0.0.0/0
to the specified ports.By following this detailed guide and ensuring that VPC security groups restrict ingress access on vulnerable ports from the open internet, you can significantly improve the security posture of your AWS environment, complying with Control Tower Guardrails and best security practices.