S3 bucket ACL permits listing by all users

Remove public S3 bucket ACLs and check permissions for object listings and contents separately.

Description

If AccessControl: PublicRead takes effect, anyone can list the bucket’s objects, including anonymous callers. Reading a listed object requires a separate grant.

Potential impact

Object names and paths can reveal the structure of stored data. Separate object-read permissions may expose the files themselves.

Remediation

Check Object Ownership, bucket and account Block Public Access, bucket policies and existing object ACLs. Preserve required access in policies and remove external bucket ACL grants before setting BucketOwnerEnforced. Verify that required clients can still work and unwanted anonymous listings and downloads are denied.

Examples

Use a globally unique BucketName for these alternatives. New buckets disable ACLs and block public access by default. Keep account and organization protections in place.

Before

yaml
Parameters:
  BucketName:
    Type: String
Resources:
  JenkinsArtifacts01:
    Type: AWS::S3::Bucket
    Properties:
      AccessControl: PublicRead
      BucketName: !Ref BucketName
      OwnershipControls:
        Rules:
          - ObjectOwnership: ObjectWriter
      PublicAccessBlockConfiguration:
        BlockPublicAcls: false
        IgnorePublicAcls: false
        BlockPublicPolicy: true
        RestrictPublicBuckets: true
      Tags:
        - Key: CostCenter
          Value: ITEngineering

ObjectWriter and the two disabled ACL-blocking settings allow PublicRead to take effect at the bucket level if higher-level controls allow it.

After

yaml
Parameters:
  BucketName:
    Type: String
Resources:
  JenkinsArtifacts01:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Ref BucketName
      OwnershipControls:
        Rules:
          - ObjectOwnership: BucketOwnerEnforced
      PublicAccessBlockConfiguration:
        BlockPublicAcls: true
        IgnorePublicAcls: true
        BlockPublicPolicy: true
        RestrictPublicBuckets: true
      VersioningConfiguration:
        Status: Enabled
      Tags:
        - Key: CostCenter
          Value: ITEngineering
        - Key: Type
          Value: CICD

BucketOwnerEnforced disables ACLs and all four Block Public Access settings are on. Versioning protects earlier versions independently of access control.

References