Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of having empty WAF Regional Rules in AWS CloudWatch using the AWS console, follow these step-by-step instructions:
  1. Login to AWS Console: Go to the AWS Management Console and login with your credentials.
  2. Navigate to AWS WAF Service: In the AWS Management Console, search for “WAF & Shield” in the services search bar and click on the “WAF & Shield” service.
  3. Select the AWS WAF Regional: In the AWS WAF & Shield dashboard, click on the “AWS WAF” tab on the left-hand side.
  4. Choose the Regional Web ACL: Select the Web ACL that you want to remediate by clicking on its name.
  5. Review the Rules: In the Web ACL details page, review the rules that are currently configured. Identify any rules that are empty or not properly configured.
  6. Edit the Rule: Click on the rule that is empty or not properly configured to edit it.
  7. Add or Modify Conditions: Add appropriate conditions or modify the existing conditions for the rule to ensure it is not empty. You can define conditions based on IP addresses, request headers, query strings, etc., depending on your specific security requirements.
  8. Save the Changes: Once you have added or modified the conditions for the rule, save the changes.
  9. Deploy the Web ACL: After making the necessary changes, deploy the Web ACL to ensure that the changes take effect.
  10. Monitor the Web ACL: Regularly monitor the Web ACL to ensure that the rules are properly configured and not empty.
By following these steps, you can remediate the misconfiguration of having empty WAF Regional Rules in AWS CloudWatch using the AWS console.

To remediate the misconfiguration of empty WAF Regional Rules in AWS CloudWatch using AWS CLI, follow these steps:
  1. List the WAF Regional Rules in your AWS account by running the following command in AWS CLI:
  1. Identify the Web ACL ID of the WAF Regional Rules that are empty.
  2. Update the empty WAF Regional Rules by adding appropriate rules using the following command:
Replace <WebACLID> with the actual Web ACL ID of the empty WAF Regional Rules.
  1. Create a JSON file named update-rules.json with the appropriate WAF rules that you want to add. Here is an example of how the JSON file may look like:
  1. Run the update command with the JSON file to add the rules to the empty WAF Regional Rules.
  2. Verify that the WAF Regional Rules are no longer empty by listing the Web ACLs again:
By following these steps, you can remediate the misconfiguration of empty WAF Regional Rules in AWS CloudWatch using AWS CLI.
To remediate the misconfiguration of WAF Regional Rules being empty in AWS CloudWatch using Python, you can follow these steps:
  1. Install the Boto3 library for AWS SDK for Python by running the following command:
  2. Use the following Python script to check if the WAF Regional Rules are empty and update them if necessary:
  1. Replace 'WAFRuleId' with the desired WAF rule ID that you want to add as a default rule.
  2. Run the Python script to check and update the WAF Regional Rules in AWS CloudWatch.
This script will check each WebACL in AWS WAF Regional and add a default WAF rule if the rules are empty. It’s important to customize the default rule according to your specific security requirements before running the script.
This change updates the existing aws_wafregional_web_acl in place (no forced replacement), but it will start enforcing the attached rule and can affect live traffic; choose the rule logic and action.type carefully.To verify, terraform plan should show your aws_wafregional_web_acl gaining a non-empty rule block (priority 1 with Action = BLOCK and Type = REGULAR), and, if newly created, an aws_wafregional_rule resource being added.