π AWS EC2 Security Group allows public IPv6 (::/0) access to admin ports π’
- Contextual name: π Security Group allows public IPv6 (::/0) access to admin ports π’
- ID:
/ce/ca/aws/ec2/security-group-allows-public-ipv6-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
.Rationaleβ
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 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.- Ensure no rule exists that has a port range that includes port
22
,3389
, or other remote server administration ports for your environment and has aSource
of::/0
.... see more
Remediationβ
Remediationβ
From AWS CLIβ
Inline JSON exampleβ
aws ec2 revoke-security-group-ingress \
--group-id {{sg-id}} \
--ip-permissions '[{"IpProtocol": "{{tcp}}","FromPort": {{22}},"ToPort": {{22}},"Ipv6Ranges": [{ "CidrIpv6": "::/0" }]}]'Using a fileβ
Extract the existing rule to a file:
aws ec2 describe-security-groups \
--group-id {{sg-id}} \
--query "SecurityGroups[0].IpPermissions[?Ipv6Ranges[?CidrIpv6=='::/0']]" \
--output json > {{revoke-rule}}.jsonRevoke it by referencing the file:
aws ec2 revoke-security-group-ingress \
--group-id {{sg-id}} \
--ip-permissions file://{{revoke-rule}}.jsonNote: 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
.... see more