Description
An effective public-read bucket ACL lets anyone list objects, including anonymous callers. public-read-write also permits new uploads. Reading an object’s contents requires separate permission.
Potential impact
Public listings can disclose names, and unwanted uploads can increase storage and request costs. A user who owns neither the bucket nor an existing object cannot overwrite or delete that object with the bucket’s WRITE grant alone.
Remediation
Use amazon.aws.s3_bucket to manage buckets. Check Object Ownership, Block Public Access, bucket policies and object ACLs. Move necessary grants into policies before disabling ACLs. If ACLs must remain, limit grants to the required accounts. For intentionally public data allow only the required reads, then verify both expected and denied access.
Examples
These tasks use the legacy amazon.aws.aws_s3, now redirected to amazon.aws.s3_object. Collection 6.0.0 removed bucket creation and deletion from that module. Use the examples to inspect old configurations.
Before
- name: Create an empty bucket
amazon.aws.aws_s3:
bucket: mybucket
mode: create
permission: public-read
- name: Create an empty bucket
amazon.aws.aws_s3:
bucket: mybucket-logs
mode: create
permission: public-read-write
After
- name: Create an empty bucket
amazon.aws.aws_s3:
bucket: mybucket
mode: create
permission: private
Explanation:
- First example: The ACLs on
mybucketandmybucket-logsrequest public listing. The second also requests upload access. Block Public Access can reject or ignore those grants, andBucketOwnerEnforceddisables ACLs. - Second example: In
amazon.aws1.5.0, rerunningmode: createleaves the ACL on an existingmybucketunchanged. Update that bucket’s ACL explicitly and checkmybucket-logsseparately. This task does not touch it.