π AWS EC2 Security Group allows public IPv4 (0.0.0.0/0) access to admin ports π’
- Contextual name: π Security Group allows public IPv4 (0.0.0.0/0) access to admin ports π’
- ID:
/ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports
- Located in: π AWS EC2
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- Internal
dec-x-bcae85fb
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-x-bcae85fb | 2 |
Logicβ
- π§ prod.logic.yaml π’
Descriptionβ
Descriptionβ
Security groups provide stateful filtering of ingress and egress network traffic to AWS resources. It is recommended that no security group allows unrestricted ingress access to remote server administration ports, such as SSH to port
22
and RDP to port3389
, using either the TCP (6), UDP (17) or ALL (-1) protocolsRationaleβ
Public access to remote server administration ports, such as 22 and 3389, increases resource attack surface and unnecessarily raises the risk of resource compromise.
Impactβ
When updating an existing environment, ensure that administrators have access to remote server administration ports through another mechanism before removing access by deleting the 0.0.0.0/0 inbound rule.
Auditβ
Perform the following to determine if the account is configured as prescribed:
- Login to the AWS Management Console at https://console.aws.amazon.com/vpc/home.
- In the left pane, click
Security Groups
.- For each security group, perform the following:
- Select the security group.
- Click the
Inbound Rules
tab.... see more
Remediationβ
Remediationβ
From AWS CLIβ
To remove a specific security group rule that allows public (0.0.0.0/0) access to an administrative port, use the following command:
aws ec2 revoke-security-group-ingress \
--group-id {{sg-id}} \
--protocol {{protocol}} \
--port {{port/min-max}} \
--cidr 0.0.0.0/0Note: You must revoke the entire rule as it was originally defined β that is, exact protocol, full port range, and CIDR block β and if needed, recreate any safe sub-rules after that.
From Consoleβ
Perform the following to implement the prescribed state:
- Login to the AWS Management Console at https://console.aws.amazon.com/vpc/home.
- In the left pane, click
Security Groups
.- For each security group, perform the following:
- Select the security group.
- Click the
Inbound Rules
tab.- Click the
Edit inbound rules
button.- Identify the rules to be edited or removed.
- Either:
- A. update the Source field to a range other than 0.0.0.0/0, or,
- B. Click
Delete
to remove the offending inbound rule.... see more