Skip to main content

More Info:

Load balancers should have request logging enabled. Logging requests to ELB endpoints is a helpful way of detecting and investigating potential attacks.

Risk Level

Informational

Address

Operational Maturity, Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • 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)
  • FedRAMP
  • GDPR
  • HIPAA
  • HITRUST CSF
  • 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
  • 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
  • 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 ELB not having logging enabled in AWS, you can follow the below steps using the AWS Console:
  1. Login to your AWS Management Console and navigate to the EC2 Dashboard.
  2. From the EC2 Dashboard, click on the Load Balancers link located on the left side of the page.
  3. Select the Load Balancer that you want to enable logging for.
  4. Click on the Edit Attributes button located at the bottom of the page.
  5. In the Edit Attributes window, scroll down to the Access Logs section.
  6. Select the Enable Access Logs checkbox.
  7. In the S3 Bucket field, enter the name of the S3 bucket where you want to store the access logs.
  8. In the S3 Prefix field, enter a prefix for the access logs.
  9. Click on the Save button to save the changes.
After following these steps, the ELB access logs will be enabled and will start logging to the specified S3 bucket. You can then use these logs for troubleshooting and analysis purposes.

To remediate the misconfiguration of ELB not having logging enabled in AWS using AWS CLI, follow the below steps:Step 1: Open the AWS CLI and run the following command to enable access logs for the ELB:
Note: Replace <ELB Name>, <S3 Bucket Name> and <S3 Bucket Prefix> with the appropriate values.Step 2: Verify if the access logs are enabled for the ELB by running the following command:
This command will return the value of “AccessLog” parameter as “true” if the access logs are enabled for the ELB.Step 3: Check if the logs are being written to the S3 bucket by running the following command:
This command will list all the log files that are being written to the specified S3 bucket. If the logs are being written, then the access logs are successfully enabled for the ELB.By following these steps, you can remediate the misconfiguration of ELB not having logging enabled in AWS using AWS CLI.
To remediate the ELB logging misconfiguration in AWS using Python, you can follow these steps:
  1. First, you need to import the Boto3 library in your Python script. Boto3 is the AWS SDK for Python, which allows you to interact with AWS services using Python code.
  1. Next, you need to create a Boto3 client for the Elastic Load Balancing (ELB) service.
  1. Then, you can use the describe_load_balancers method to get a list of all the ELBs in your AWS account.
  1. Once you have the list of ELBs, you can loop through each ELB and check if logging is enabled or not. You can use the describe_load_balancer_attributes method to get the attributes of each ELB.
  1. Finally, you can modify the ELB attributes using the modify_load_balancer_attributes method to enable logging for the ELB.
The above Python code will check if logging is enabled for each ELB in your AWS account. If logging is not enabled, it will enable logging for that ELB.
This change is an in-place update and does not force replacement of the load balancer.To verify, terraform plan should show an in-place update (~ on aws_lb.EXAMPLE_LB) adding or modifying the access_logs block with enabled = true and the specified bucket.

Additional Reading: