Skip to main content

More Info:

Any S3 buckets used by AWS CloudTrail should have Server Access Logging feature enabled in order to track requests for accessing the buckets and necessary for security audits.

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • AWS Well Architected Framework
  • 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)
  • GDPR
  • HIPAA
  • 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) 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
  • StateRAMP
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “Server Access Logging Feature Should Be Enabled” for AWS using the AWS console, follow these steps:
  1. Login to the AWS Management Console.
  2. Navigate to the S3 service.
  3. Select the S3 bucket for which you want to enable server access logging.
  4. Click on the “Properties” tab.
  5. Scroll down to the “Server access logging” section and click on “Edit”.
  6. Select the checkbox “Enable logging”.
  7. Choose the target bucket and target prefix for the log files.
  8. Click on “Save changes”.
Once you have enabled the server access logging feature, all access requests made to the S3 bucket will be logged and stored in the target bucket you have specified. This will help you track and monitor all access to your S3 bucket, which can help you identify any potential security threats or unauthorized access attempts.

To remediate the misconfiguration “Server Access Logging Feature Should Be Enabled” for an AWS S3 bucket using AWS CLI, follow these steps:
  1. Open the AWS CLI on your computer.
  2. Enter the following command to enable server access logging for an S3 bucket:
Replace <bucket-name> with the name of the S3 bucket you want to enable server access logging for.
  1. Enter the following command to create a new S3 bucket policy that allows the S3 bucket owner to write server access logs to the bucket:
Replace <bucket-name> with the name of the S3 bucket you want to enable server access logging for and replace AWS-account-ID with your AWS account ID.
  1. Enter the following command to enable server access logging for the S3 bucket:
Replace <bucket-name> with the name of the S3 bucket you want to enable server access logging for and replace AWS-account-ID with your AWS account ID.After following these steps, server access logging will be enabled for the specified S3 bucket.
To remediate the misconfiguration “Server Access Logging Feature Should Be Enabled” in AWS using Python, you can follow the below steps:
  1. Import the necessary AWS SDK modules in Python:
  1. Initialize the AWS SDK client for S3:
  1. List all the S3 buckets in your AWS account:
  1. For each bucket, check if server access logging is enabled:
  1. Save the Python script and run it to enable server access logging for all S3 buckets in your AWS account.
Note: Make sure you have the necessary AWS credentials configured to run the Python script.
Substitute:
  • TRAIL_NAME with your CloudTrail trail name.
  • CLOUDTRAIL_BUCKET_NAME with the existing S3 bucket CloudTrail uses.
  • LOG_BUCKET_NAME with the S3 bucket that will store access logs (must be in the same region as CLOUDTRAIL_BUCKET_NAME and must not be the same bucket).
This change does not force replacement of the CloudTrail trail or either S3 bucket; it adds/updates logging and ACL configuration in place.To verify, terraform plan should show:
  • A new aws_s3_bucket_logging.cloudtrail_access_logging resource enabling logging from CLOUDTRAIL_BUCKET_NAME to LOG_BUCKET_NAME with the configured prefix.
  • A new or updated aws_s3_bucket_acl.cloudtrail_logs_bucket_acl resource granting WRITE and READ_ACP to the S3 LogDelivery group on LOG_BUCKET_NAME.

Additional Reading: