π 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
- Located in: π AWS EC2
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- Cloud Conformity
- Internal
dec-z-dbeeed9f
dec-z-f778950c
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-z-dbeeed9f | 1 | |
βοΈ dec-z-f778950c | 1 |
Logicβ
- π§ prod.logic.yaml π’
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.