Profile Applicability: Level 1
Description:
CloudTrail logs are a record of every API call made in your AWS account. These logs file are stored in an S3 bucket. By default, Amazon S3 buckets and objects are private. Only the resource owner (the AWS account that created the bucket) can access the bucket and the objects it contains. The resource owner can grant access permissions to other resources and users by writing an access policy. If you want to create or modify an Amazon S3 bucket to receive the log files for an organization trail, you must further modify the bucket policy
Rationale:
Allowing public access to CloudTrail log content may aid an adversary in identifying weaknesses in the affected account's use or configuration.
Impact:
It is recommended that the bucket policy, or Access Control List (ACL), be applied to the S3 bucket that CloudTrail logs to prevent public access to the CloudTrail logs.
Default Value:
By default, S3 buckets are not publicly accessible.
Pre-Requisite:
Log in as an admin or IAM user with the required permissions
If you found s3 bucket with public access then only follow the implementation
Make note of all the permissions that exist as backout
Remediation:
Test Plan:
Perform the following to determine if any public access is granted to an S3 bucket via an ACL or S3 bucket policy: Via the Management Console.
1. Go to the Amazon CloudTrail console at https://console.aws.amazon.com/cloudtrail
2. In the APP activity history pane on the left, click Trails.
3. In the Trails pane, note the bucket names in the S3 bucket column
4. Go to Amazon S3 console at https://s3.console.aws.amazon.com/s3
5. For each bucket noted in step 3, click on the bucket
6. Click on the Permissions tab.
7. Go to the Block Public Access and check if it off or on
CLI commands
It will give bucket is public access or not
aws cloudtrail describe-trails
Implementation:
Perform the following to remove any public access that has been granted to the bucket via an ACL or S3 bucket policy:
Go to Amazon S3 console at https://console.aws.amazon.com/s3
Select the bucket that you found in the audit section to edit
Click on the Permissions tab.
4. Click on Edit under the Block public access section
5. Check the Block all public access check Box and click on save changes
CLI commands
It will change the bucket logging into private
aws s3api put-bucket-acl
--bucket cloudtrail-global-logging
--acl private
Backout Plan:
Go to Amazon S3 console at https://console.aws.amazon.com/s3
Select the bucket that you found in audit section to edit
Click on the Permissions tab.
4. Click on Edit under the Block public access section.
5. Uncheck the Block all public access check box and click on "Save Changes".
Using AWS CLI Commands
It will change the bucket to public access.
aws s3api put-public-access-block --bucket <bucket_name> --public-access-block-configuration "{\"IgnorePublicAcls\": true}"
References:
1. CCE-78915-6
2. https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html
CIS Controls:
14.6 Protect Information through Access Control Lists
Protect all information stored on systems with file system, network share, claims, application, or database specific access control lists. These controls will enforce the principle that only authorized individuals should have access to the information based on their need to access the information as a part of their responsibilities.