Skip to main content

More Info:

WAF logging should be enabled

Risk Level

High

Address

Operational Maturity, Reliability, 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)
  • GDPR
  • HIPAA
  • ISO 27001
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • Reserve Bank of India (RBI) Cyber Security Framework
  • Reserve Bank of India (RBI) Master Direction – Information Technology Framework
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of WAF Logging not being enabled in AWS CloudWatch using the AWS Management Console, follow these steps:
  1. Sign in to the AWS Management Console: Go to https://aws.amazon.com/ and sign in to your AWS account.
  2. Navigate to AWS WAF Console: Click on the “Services” dropdown menu at the top of the page, search for “WAF & Shield” under the Security, Identity, & Compliance category, and click on it.
  3. Select the Web ACL: In the left-hand navigation pane, click on “Web ACLs”.
  4. Choose the Web ACL: Select the Web ACL for which you want to enable logging by clicking on its name.
  5. Enable Logging: In the Web ACL details page, click on the “Logging” tab.
  6. Enable Logging: Click on the “Edit” button to modify the logging configuration.
  7. Enable Logging: Toggle the “Enable Logging” option to enable logging for the Web ACL.
  8. Choose Logging Destination: Select the CloudWatch log group where you want to store the logs. If you don’t have an existing log group, you can create a new one by clicking on the “Create a new CloudWatch log group” button.
  9. Save Changes: Click on the “Update” button to save the changes and enable logging for the Web ACL.
  10. Verify Logging: To verify that logging is enabled, you can check the CloudWatch logs in the specified log group to ensure that the WAF logs are being generated and stored correctly.
By following these steps, you will successfully remediate the misconfiguration of WAF Logging not being enabled in AWS CloudWatch using the AWS Management Console.

To remediate the misconfiguration of WAF logging not being enabled in AWS CloudWatch using AWS CLI, follow these steps:
  1. Enable logging for your Web Application Firewall (WAF) in the AWS Management Console:
    • Navigate to the AWS WAF console.
    • Select the WebACL for which you want to enable logging.
    • Click on the “Logging and Metrics” tab.
    • Click on “Edit Logging Configuration” and enable logging.
    • Choose the Amazon Kinesis Data Firehose delivery stream or Amazon S3 bucket where you want to store the logs.
  2. Use AWS CLI to enable logging for your WAF:
    • Open your terminal or command prompt.
    • Run the following AWS CLI command to associate a logging configuration with your WebACL:
      Replace <web-acl-id> with the ID of your WebACL and <log-destination-arn> with the ARN of the Amazon Kinesis Data Firehose delivery stream or Amazon S3 bucket where you want to store the logs.
  3. Verify that logging is enabled:
    • Run the following AWS CLI command to describe the logging configuration for your WebACL:
    • Check the output to ensure that the logging configuration is correctly set up and enabled.
By following these steps, you can remediate the misconfiguration of WAF logging not being enabled in AWS CloudWatch using AWS CLI.
To enable WAF logging in AWS CloudWatch using Python, you can use the AWS SDK for Python (Boto3). Follow these steps to remediate the misconfiguration:
  1. Install Boto3:
  1. Create a Python script with the following code:
  1. Replace the following placeholders in the script:
  • YOUR_WEB_ACL_ID: Replace this with the ID of the WebACL for which you want to enable logging.
  • REGION: Replace this with the AWS region where the logs will be stored.
  • ACCOUNT_ID: Replace this with your AWS account ID.
  • LOG_GROUP_NAME: Replace this with the name of the CloudWatch log group where WAF logs will be stored.
  • FIREHOSE_NAME: Replace this with the name of the Kinesis Data Firehose delivery stream where logs will be delivered.
  1. Run the Python script to enable WAF logging in AWS CloudWatch:
After running this script, WAF logging will be enabled for the specified WebACL, and the logs will be stored in the CloudWatch log group you specified.
This change does not force replacement of the Web ACL; it adds a separate logging configuration resource. terraform plan should show creation of aws_cloudwatch_log_group.waf_logs, aws_cloudwatch_log_resource_policy.waf_logs, and aws_wafv2_web_acl_logging_configuration.this with no destroy/replace for the existing Web ACL.