Skip to main content

More Info:

WAF should be enabled so that this firewall will prevent malicious attackers to intrude into your system.

Risk Level

High

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • AWS Startup Security Baseline
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • HITRUST CSF
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST CSF
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • PCI
  • Reserve Bank of India (RBI) Cyber Security Framework
  • Reserve Bank of India (RBI) Master Direction – Information Technology Framework
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “ELB Should Have WAF Enabled” in AWS using the AWS console, you can follow the below steps:
  1. Login to the AWS console.
  2. Navigate to the EC2 dashboard.
  3. Click on the Load Balancers option from the left-hand menu.
  4. Select the ELB for which you want to enable the WAF.
  5. Click on the Listeners tab.
  6. Click on the Edit button next to the listener for which you want to enable the WAF.
  7. In the Edit Listener dialog box, click on the Add Rule button.
  8. Select the AWS WAF option from the dropdown menu.
  9. Choose the WebACL that you want to associate with the ELB.
  10. Click on the Save button to save the changes.
Once you have completed the above steps, the WAF will be enabled for your ELB in AWS.

To remediate the misconfiguration of ELB not having WAF enabled in AWS using AWS CLI, follow the below steps:
  1. Open AWS CLI on your local machine and run the following command to list all the AWS Elastic Load Balancers:
  1. From the response, identify the ARN of the ELB that you want to enable WAF for.
  2. Run the following command to create an AWS WAF WebACL:
Note: Replace “MyWebACL” with a name of your choice for the WebACL.
  1. From the response, note down the ARN of the newly created WebACL.
  2. Run the following command to associate the WebACL with the ELB:
Note: Replace the WebACL ARN and ELB ARN with the ARNs that you noted down in the previous steps.
  1. Finally, verify that the WAF is enabled for the ELB by running the following command:
Note: Replace the ELB ARN with the ARN of the ELB that you enabled WAF for.Once you have completed these steps, WAF will be enabled for the specified ELB in your AWS environment.
To remediate the misconfiguration of ELB not having WAF enabled in AWS using Python, follow these steps:
  1. Import the necessary libraries:
  1. Create a boto3 client for AWS WAF:
  1. Create a boto3 client for AWS ELB:
  1. Get a list of all the ELBs in the region:
  1. Loop through each ELB and check if WAF is enabled:
  1. If WAF is not enabled for an ELB, create a new web ACL, add a rule to it, and associate it with the ELB.
  2. The final code will look like this:
Note: This code is just an example. You may need to modify it according to your specific requirements.
Associating the Web ACL via aws_wafv2_web_acl_association may change how traffic is handled but does not force replacement of the load balancer itself; it only creates or replaces the WAF association for that ALB.After updating Terraform, terraform plan should show one new aws_wafv2_web_acl_association to be created (or updated if it existed) with resource_arn set to the ALB ARN and web_acl_arn set to the desired WAFv2 Web ACL ARN.

Additional Reading: