Skip to main content

More Info:

AWS S3 Server Access Logging feature should be enabled in order to record access requests useful for security audits. By default, server access logging is not enabled for S3 buckets.

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS AWS
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • 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
  • 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

Sure, here are the step-by-step instructions to remediate the misconfiguration “S3 Buckets Should Have Access Logging Enabled” in AWS using the AWS console:
  1. Login to the AWS Management Console.
  2. Navigate to the S3 service.
  3. Select the S3 bucket for which you want to enable access logging.
  4. Click on the “Properties” tab.
  5. Scroll down to the “Server access logging” section and click on the “Edit” button.
  6. Select the “Enable logging” checkbox.
  7. Specify the target bucket where you want to store the access logs.
  8. Optionally, you can also specify a prefix for the log files.
  9. Click on the “Save changes” button to enable access logging for the S3 bucket.
Once you have completed these steps, access logging will be enabled for the S3 bucket and all the access logs will be stored in the target bucket that you specified. This will help you to track all the requests made to the S3 bucket and ensure that there are no unauthorized access attempts.

To remediate the misconfiguration of S3 Buckets not having Access Logging enabled in AWS using AWS CLI, follow these steps:
  1. Open the AWS CLI on your local machine and ensure that you have the necessary permissions to access the AWS account.
  2. Run the following command to enable access logging for the S3 bucket:
    Replace <bucket-name> with the name of the S3 bucket for which you want to enable access logging. Replace <prefix> with the desired prefix for the access log file.
  3. After running the command, verify that access logging has been enabled for the S3 bucket by running the following command:
    This command should return the access logging configuration for the S3 bucket.
  4. Repeat the above steps for all the S3 buckets in the AWS account that do not have access logging enabled.
By following these steps, you can remediate the misconfiguration of S3 Buckets not having Access Logging enabled in AWS using AWS CLI.
To remediate the misconfiguration of S3 buckets not having access logging enabled in AWS using Python, you can follow these steps:
  1. First, you need to identify the S3 buckets that do not have access logging enabled. You can use the AWS SDK for Python (Boto3) to list all the S3 buckets in your AWS account and check if access logging is enabled for each bucket.
Here is a sample code snippet to list all the S3 buckets and check if access logging is enabled for each bucket:
  1. The above code snippet will enable access logging for all the S3 buckets that do not have it enabled. The access logs will be stored in a folder named access-logs in the same bucket.
Note: You need to have the necessary permissions to enable access logging for S3 buckets in your AWS account.
This change does not force replacement of either bucket; Terraform will update the ACL on the log bucket and enable logging on the source bucket in place.Verification: terraform plan should show an update to aws_s3_bucket_acl.log_bucket_acl (adding WRITE and READ_ACP for the LogDelivery group) and an update or creation of aws_s3_bucket_logging.source_bucket_logging with target_bucket = LOG_BUCKET_NAME and target_prefix = "SOURCE_BUCKET_NAME/".

Additional Reading: