AWS Introduction
AWS Pricing
AWS Threats
AWS Misconfigurations
- Getting Started with AWS Audit
- Permissions required for Misconfigurations Detection
- API Gateway Audit
- Cloudformation Audit
- CloudFront Audit
- CloudTrail Audit
- Cloudwatch Audit
- DynamoDB Audit
- EC2 Audit
- Elastic Search Audit
- ELB Audit
- IAM Audit
- KMS Audit
- Kubernetes Audit
- Lambda Audit
- RDS Audit
- Redshift Audit
- Route53 Audit
- S3 Audit
- Security Groups Audit
- SES Audit
- SNS Audit
- IAM Deep Dive
- App Sync Audit
- Code Build Audit
- Open Search Audit
- Shield Audit
- SQS Audit
Network Firewall Policy Default Action Should Be Set For Fragmented Packets
More Info:
This rule checks if an AWS Network Firewall policy is configured with a user-defined stateless default action for fragmented packets. It ensures that the stateless default action for fragmented packets matches the user-defined default action. The rule is marked as non-compliant if the stateless default action for fragmented packets does not match the user-defined default action.
Risk Level
Medium
Address
Security
Compliance Standards
CBP
Triage and Remediation
Remediation
To remediate the issue of the Network Firewall Policy Default Action not being set for fragmented packets in AWS EC2, you can follow these steps using the AWS Management Console:
-
Sign in to the AWS Management Console: Go to https://aws.amazon.com/ and sign in to your AWS account.
-
Navigate to the Amazon VPC Console: Click on the “Services” dropdown menu at the top of the page, select “VPC” under the Networking & Content Delivery section.
-
Select the VPC: In the VPC dashboard, click on the VPC ID where your EC2 instance is located.
-
Go to the Network ACLs: In the left-hand menu, click on “Network ACLs” to view the list of Network Access Control Lists associated with the selected VPC.
-
Identify the Default Network ACL: Locate the default Network ACL associated with the VPC. The default Network ACL is named “default” and is automatically associated with all subnets in the VPC unless explicitly changed.
-
Edit the Network ACL Rules:
- Click on the default Network ACL ID to view its inbound and outbound rules.
- Look for the rule that controls fragmented packets. By default, AWS allows fragmented packets.
- If there is an explicit rule denying fragmented packets, edit the rule to allow them. If there is no specific rule, you may need to add a new rule to allow fragmented packets.
-
Add or Edit Rule for Fragmented Packets:
- Click on the “Edit” button to modify the inbound or outbound rules of the Network ACL.
- Add a new entry or edit an existing rule to allow fragmented packets. Set the rule to allow fragmented packets by setting the rule number, type (inbound or outbound), protocol (e.g., all protocols or specific protocols that use fragmented packets), port range if applicable, source or destination IP range, and action to “Allow”.
-
Save the Changes: After adding or editing the rule to allow fragmented packets, click on the “Save” button to apply the changes to the default Network ACL.
By following these steps and ensuring that the default Network ACL associated with your VPC allows fragmented packets, you can remediate the misconfiguration related to the Network Firewall Policy Default Action for fragmented packets in AWS EC2 using the AWS Management Console.
To remediate the issue of Network Firewall Policy Default Action not being set for fragmented packets in AWS EC2 using AWS CLI, follow these steps:
-
Open the AWS CLI on your local machine.
-
Run the following command to describe the current Network Firewall Policy for your VPC:
aws ec2 describe-network-acls --filters "Name=vpc-id,Values=<your-vpc-id>"
Replace <your-vpc-id>
with the ID of your VPC.
-
Identify the Network ACL that needs to be updated based on the output of the previous command.
-
Run the following command to update the Network ACL entry for fragmented packets:
aws ec2 update-network-acl-entry --network-acl-id <your-network-acl-id> --egress --rule-number <rule-number> --protocol all --rule-action allow --cidr-block 0.0.0.0/0 --port-range From=0,To=65535 --fragment-acknowledgment-required --fragment-reorder --fragment-action drop
Replace <your-network-acl-id>
with the ID of the Network ACL that needs to be updated, and <rule-number>
with the appropriate rule number in the Network ACL.
- Verify that the update was successful by running the describe-network-acls command again.
By following these steps, you can remediate the misconfiguration of not setting the Network Firewall Policy Default Action for fragmented packets in AWS EC2 using AWS CLI.
To remediate the network firewall policy default action for fragmented packets in AWS EC2 using Python, you can use the AWS SDK for Python (Boto3) to update the Network ACL associated with the VPC. Here are the step-by-step instructions to remediate this misconfiguration:
- Install Boto3: If you haven’t already installed Boto3, you can install it using pip:
pip install boto3
- Use the following Python script to update the default action for fragmented packets in the Network ACL associated with your VPC:
import boto3
# Initialize the EC2 client
ec2_client = boto3.client('ec2')
# Specify the VPC ID where the Network ACL is associated
vpc_id = 'your_vpc_id'
# Specify the Network ACL ID that you want to update
network_acl_id = 'your_network_acl_id'
# Update the default action for fragmented packets in the Network ACL
response = ec2_client.update_network_acl_entry(
CidrBlock='0.0.0.0/0',
Egress=False,
NetworkAclId=network_acl_id,
PortRange={
'From': 0,
'To': 65535
},
Protocol='-1',
RuleAction='allow',
RuleNumber=100,
)
print('Default action for fragmented packets updated successfully.')
-
Replace
'your_vpc_id'
and'your_network_acl_id'
with your actual VPC ID and Network ACL ID. -
Run the Python script to update the default action for fragmented packets in the specified Network ACL.
After running the script, the default action for fragmented packets in the specified Network ACL will be set to ‘allow’. You can customize the script further based on your specific requirements and configurations.