Profile Applicability:
Level 1
Description:
This check ensures that no Network ACLs (NACLs) in your VPC allow inbound traffic from the internet (0.0.0.0/0) to any port. Allowing unrestricted ingress traffic poses significant security risks.
Rationale:
Restricting ingress traffic from the internet enhances security by preventing unauthorized access to your VPC resources. Network ACLs should be configured to allow only necessary and trusted traffic.
Impact:
Positive Impact: Improved security by preventing unauthorized access and reducing the attack surface.
Negative Impact: Potential disruption for services or applications that rely on public access. Alternatives for secure access must be implemented.
Default Value:
By default, Network ACLs do not allow inbound traffic from the internet. However, explicit rules may have been added.
Pre-Requisite:
IAM Permissions: Ensure necessary permissions to view and modify Network ACL rules.
AWS Services: VPC, Network ACLs
Tools Required: AWS Management Console, AWS CLI
Remediation:
Test plan:
Using AWS Console:
Sign In: Log in to the AWS Management Console.
Navigate to VPC: Go to the VPC console.
In the left navigation pane, choose Network ACLs.
For each Network ACL, review the ingress rules to identify any that allow traffic from 0.0.0.0/0
Select the Network ACL and click Edit inbound rules.
Remove any rule that allows ingress from 0.0.0.0/0
Click Save to apply the changes.
Using AWS CLI:
List Network ACLs: Retrieve all Network ACLs and their entries:
aws ec2 describe-network-acls --query "NetworkAcls[*].{ID:NetworkAclId,Entries:Entries}" --output json > /tmp/network-acls.json
Identify Entries with Ingress from 0.0.0.0/0: Filter for Network ACL entries allowing ingress from 0.0.0.0/0
jq '.[] | select(.Entries[]? | select(.RuleAction == "allow" and .CidrBlock == "0.0.0.0/0" and .Egress == false))' /tmp/network-acls.json > /tmp/insecure-nacls.json
Remove Ingress Rule: For each identified Network ACL, remove the rule allowing ingress from 0.0.0.0/0
NETWORK_ACL_IDS=$(jq -r '.[].ID' /tmp/insecure-nacls.json) for ACL_ID in $NETWORK_ACL_IDS; do ENTRIES=$(jq -r --arg ID "$ACL_ID" '.[] | select(.ID == $ID) | .Entries[].RuleNumber' /tmp/insecure-nacls.json) for ENTRY in $ENTRIES; do aws ec2 delete-network-acl-entry --network-acl-id $ACL_ID --rule-number $ENTRY --ingress done done
Implementation:
Using AWS Console:
Log in to the AWS Management Console
Go to the VPC console by selecting "Services" and then choosing "VPC" from the dropdown menu.
Select Network ACLs: In the left navigation pane, choose Network ACLs.
Review Ingress Rules: For each Network ACL, review the ingress rules to identify any that allow traffic from 0.0.0.0/0.
Edit Ingress Rules: Select the Network ACL and click Edit inbound rules.
Remove Ingress Rule: Remove any rule that allows ingress from 0.0.0.0/0.
Save Changes: Click Save to apply the changes.
Backout Plan:
Revert Ingress Rules:
If issues arise after removing the ingress rules, re-add the rules allowing ingress from trusted IP ranges only.
Restore Configuration:
Use saved Network ACL configurations to reapply previous settings if needed:
aws ec2 create-network-acl-entry --network-acl-id <NetworkAclId> --rule-number <RuleNumber> --protocol <Protocol> --rule-action allow --egress false --cidr-block <TrustedIpRange> --port-range From=<PortRangeFrom>,To=<PortRangeTo>