🛡️ AWS EC2 Security Group allows unrestricted DNS traffic🟢
- Contextual name: 🛡️ Security Group allows unrestricted DNS traffic🟢
- ID:
/ce/ca/aws/ec2/security-group-allows-unrestricted-dns-traffic
- Tags:
- Policy Type:
COMPLIANCE_POLICY
- Policy Categories:
SECURITY
Logic
Similar Policies
- Cloud Conformity: Unrestricted DNS Access
- Internal:
dec-z-dbeeed9f
- Internal:
dec-z-f778950c
Similar Internal Rules
Rule | Policies | Flags |
---|---|---|
✉️ dec-z-dbeeed9f | 1 | |
✉️ dec-z-f778950c | 1 |
Description
Description
AWS EC2 Security Groups should not allow unrestricted DNS traffic to avoid exposure to security vulnerabilities. Security group rules should be configured to limit DNS traffic (UDP port 53) to trusted IP ranges, such as internal networks or approved DNS servers, reducing the risk of misuse or attacks such as DNS amplification.
Rationale
Restricting DNS traffic prevents unauthorized use of EC2 instances for malicious activities, such as DNS tunneling or participating in amplification attacks. By limiting DNS access to trusted sources, you ensure only authorized clients and servers can interact, reducing the surface area for potential exploits.
Impact
Implementing restrictions might cause service interruptions if legitimate applications are not properly configured to use allowed DNS servers, making it essential to validate and update configurations thoroughly during remediation.
Audit
This policy marks an EC2 Security Group as
INCOMPLIANT
if it contains a rule that meets all the following conditions:... see more
Remediation
Remediation
From Command Line
- Run the following command to remove or modify the unrestricted rule for DNS access:
aws ec2 revoke-security-group-ingress \
--region {{region-name}} \
--group-id {{security-group-id}} \
--protocol {{protocol}} \
--port 53 \
--cidr {{0.0.0.0/0 or ::/0}}
Optionally, run the
authorise-security-group-ingress
command to create a new rule, specifying a trusted CIDR range instead of0.0.0.0/0
.
- Confirm the changes by describing the security group again and ensuring the unrestricted access rule has been removed or appropriately restricted:
aws ec2 describe-security-groups \
--region {{region-name}} \
--group-ids {{security-group-id}} \
--query 'SecurityGroups[*].IpPermissions[?FromPort==`53`].{CIDR:IpRanges[*].CidrIp,Port:FromPort}'
- Test the functionality of services that rely on DNS to ensure that they operate correctly with the updated security group rules.