๐ก๏ธ 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 - Tags:
- ๐ข Policy with categories
- ๐ข Policy with type
- ๐ข Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicโ
- ๐ง prod.logic.yaml๐ข
Similar Policiesโ
- Cloud Conformity: Unrestricted MySQL Access
- Internal:
dec-x-3e379c67
Similar Internal Rulesโ
| Rule | Policies | Flags |
|---|---|---|
| โ๏ธ dec-x-3e379c67 | 1 |
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
INCOMPLIANTif 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-ingresscommand 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.