π AWS EC2 Security Group allows unrestricted traffic to MySQL π’
- Contextual name: π Security Group allows unrestricted traffic to MySQL π’
- ID:
/ce/ca/aws/ec2/security-group-allows-unrestricted-traffic-to-mysql
- 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-x-3e379c67
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-x-3e379c67 | 1 |
Logicβ
- π§ prod.logic.yaml π’
Descriptionβ
Descriptionβ
Review and modify AWS EC2 Security Group settings to prevent unrestricted access to MySQL instances on port 3306. Security Groups should be configured to allow inbound traffic to MySQL only from trusted IP addresses or internal systems to minimize exposure to external threats and unauthorized access.
Rationalβ
Allowing unrestricted access to MySQL on port 3306 increases the risk of unauthorized access, brute-force attacks, data exfiltration, and potential SQL injection vulnerabilities. Exposing MySQL to the internet without proper access control is a common attack vector, and attackers may attempt to exploit weak passwords or vulnerabilities in MySQL itself. Restricting access to trusted networks ensures that only authorized users and systems can interact with the MySQL, helping protect sensitive data.
Impactβ
Requires configuring the Security Group to maintain legitimate database access for authorized users and applications.
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 MySQL access:
aws ec2 revoke-security-group-ingress \
--region {{region-name}} \
--group-id {{security-group-id}} \
--protocol {{protocol}} \
--port 3306 \
--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==`3306`].{CIDR:IpRanges[*].CidrIp,Port:FromPort}'
- Monitor MySQL access to ensure it's unaffected by the changes.