Back to controls

Ensure buckets are not publicly accessible

### Overview

Category

Controls

High

Applies to

Alibaba CloudAWSGoogle CloudMicrosoft Azure

Coverage

4 queries

Asset types

2 covered

Overview

Overview

Buckets should almost never be publicly accessible (excepting when using them to host public static websites). Although there is nothing inherently insecure about buckets, access control misconfigurations and a lack of understanding about how buckets security works can turn buckets into a vector for attack and data exfiltration. To avoid this, Cyscale looks for publicly accessible buckets.

Remediation guidance

AWS

From the Console

Perform the following actions to block all public access for a bucket:

  1. Open the security settings using the "Open in AWS" menu option
  2. Select the tab Permissions
  3. Under Block public access (bucket settings), select Edit
  4. Check the Block all public access checkbox
  5. Click Save changes

From the AWS CLI

aws s3api put-public-access-block --bucket <bucketName> --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"

Default Value

By default, new buckets, access points, and objects do not allow public access.

References

  1. Configuring block public access settings for your S3 buckets
  2. put-public-access-block

Azure

From Azure Console

First, follow the Microsoft documentation and create shared access signature tokens for your blob containers. Then, follow these steps:

To change the access level for containers

  1. Go to Storage Accounts
  2. For each storage account, go to Containers under Data storage
  3. For each container, click Change access level
  4. Select for Public access level the Private (no anonymous access) option

To change the access level for blobs

  1. Go to Storage Accounts
  2. For each storage account, under Settings, go to Configuration
  3. Set Disabled for Allow Blob public access if no anonymous access is needed on the storage account

Using Azure Command Line Interface

Set the permission for public access to private(off) for the container

az storage container set-permission --name <containerName> --public-access off --account-name <accountName> --account-key <accountKey>

Disallow public blob access for the storage account.

az storage account update --name <storageAccount> --resource-group <resourceGroup> --allow-blob-public-access false

Default Value

By default, Public access level is set to Private (no anonymous access) for blob containers. By default, AllowBlobPublicAccess is set to Null (allow in effect) for storage account.

References

  1. https://learn.microsoft.com/en-us/azure/storage/blobs/storage-manage-access-to-resources
  2. https://learn.microsoft.com/en-us/azure/storage/blobs/anonymous-read-access-prevent
  3. https://learn.microsoft.com/en-us/azure/security/benchmarks/security-controls-v2-governance-strategy#gs-2-define-enterprise-segmentation-strategy
  4. https://learn.microsoft.com/en-us/azure/security/benchmarks/security-controls-v2-network-security#ns-1-implement-security-for-internal-traffic

Google Cloud

From Google Cloud Console

  1. Go to Storage browser by visiting https://console.cloud.google.com/storage/browser
  2. Click on a bucket name to go to its Bucket details page
  3. Click on the PERMISSIONS tab
  4. For principals allUsers and allAuthenticatedUsers, click on the Edit principal pencil button to modify the permissions
  5. Click the Delete button on the right to remove that particular role assignment
  6. Select SAVE

CLI

Remove allUsers and allAuthenticatedUsers access.

gsutil iam ch -d allUsers gs://<bucketName>
gsutil iam ch -d allAuthenticatedUsers gs://<bucketName>

Prevention

You can prevent Storage buckets from becoming publicly accessible by setting up the Domain restricted sharing organization policy at: https://console.cloud.google.com/iam-admin/orgpolicies/iamallowedPolicyMemberDomains

Default Value

By default, Storage buckets are not publicly shared.

References

  1. https://cloud.google.com/storage/docs/access-control/iam-reference
  2. https://cloud.google.com/storage/docs/access-control/making-data-public
  3. https://cloud.google.com/storage/docs/gsutil/commands/iam

Addititonal information

To implement Access restrictions on buckets, configuring Bucket IAM is preferred more than configuring Bucket ACL. On GCP console, "Edit Permissions" for bucket exposes the IAM configurations only. Bucket ACLs are configured automatically as per need in order to implement/support User enforced Bucket IAM policy. In the case that the administrator changes a bucket ACL using command-line(gsutils)/API, the bucket IAM also gets updated automatically.

Alibaba Cloud

Service-wide remediation

Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.

AWS

Use AWS Organizations guardrails, AWS Config rules or conformance packs where they fit, approved account baselines, and IaC modules so new resources inherit the secure setting.

Azure

Use management group or subscription Azure Policy assignments, remediation tasks where supported, landing-zone standards, and IaC modules so drift is prevented at scale.

Google Cloud

Use organization or folder policies where available, shared project templates, logs and alerting baselines, and IaC modules so new resources inherit the secure setting.

Alibaba Cloud

Use Resource Directory guardrails, account baselines, and IaC modules so the secure setting is applied consistently across environments.

Operational rollout

  1. Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
  2. Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
  3. Re-scan and track approved exceptions with an owner and expiry date.

Query logic

These are the stored checks tied to this control.

Publicly Accessible AWS Buckets

Connectors

AWS

Covered asset types

Bucket

Expected check: eq []

{
  buckets(
    where: {
      cloudProvider: "aws"
      publicAccessBlocked: false
      OR: [
        {
          hasBucketACLGrant_SOME: {
            OR: [
              { granteeURI: "http://acs.amazonaws.com/groups/global/AllUsers" }
              {
                granteeURI: "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"
              }
            ]
            permission_IN: ["READ", "WRITE", "WRITE_ACP", "FULL_CONTROL"]
          }
        }
        {
          bucketPolicy: {
            statements_SOME: {
              effect: "Allow"
              OR: [
                { actions_INCLUDES: "s3:GetObject" }
                { actions_INCLUDES: "s3:ListObjects" }
                { actions_INCLUDES: "s3:ListObjectsV2" }
                { actions_INCLUDES: "s3:PutObject" }
                { actions_INCLUDES: "s3:PutObjectAcl" }
                { actions_INCLUDES: "s3:CreateMultipartUpload" }
                { actions_INCLUDES: "s3:UploadPart" }
                { actions_INCLUDES: "s3:DeleteObject" }
                { actions_INCLUDES: "s3:DeleteObjects" }
                { actions_INCLUDES: "s3:*" }
                { actions_INCLUDES: "*" }
              ]
              principals_INCLUDES: "AWS|*"
            }
          }
        }
      ]
    }
  ) {...AssetFragment}
}
Publicly Readable Azure Blob Containers

Connectors

Microsoft Azure

Covered asset types

BlobContainer

Expected check: eq []

{
  blobContainers(
    where: {
      cloudProvider: "azure"
      publicAccessBlocked: false
      publicAccess_IN: ["Blob", "Container"]
    }
  ) {...AssetFragment}
}
Publicly Accessible Google Cloud Buckets

Connectors

Google Cloud

Covered asset types

Bucket

Expected check: eq []

{
  buckets(
    where: {
      cloudProvider: "gcp"
      publicAccessBlocked: false
        iamBindings_SOME: {
          OR: [
            { members_INCLUDES: "allUsers" }
            { members_INCLUDES: "allAuthenticatedUsers" }
          ]
          role: {
            OR: [
              { permissions_INCLUDES: "storage.objects.get" }
              { permissions_INCLUDES: "storage.objects.list" }
              { permissions_INCLUDES: "storage.objects.create" }
              { permissions_INCLUDES: "storage.objects.delete" }
              { permissions_INCLUDES: "storage.objects.update" }
              { permissions_INCLUDES: "storage.objects.*" }
              { permissions_INCLUDES: "storage.objects.setIamPolicy" }
              {
                permissions_INCLUDES: "storage.multipartUploads.create"
              }
              { permissions_INCLUDES: "storage.multipartUploads.*" }
            ]
          }
      }
    }
  ) {...AssetFragment}
}
Publicly Accessible Alibaba Buckets

Connectors

Alibaba Cloud

Covered asset types

Bucket

Expected check: eq []

{
  buckets(
    where: {
      cloudProvider: "alibaba"
      publicAccessBlocked: false
      OR: [
        { acl_IN: ["public-read", "public-read-write"] }
        {
          bucketPolicy: {
            statements_SOME: {
              effect: "Allow"
              OR: [
                { actions_INCLUDES: "oss:GetObject" }
                { actions_INCLUDES: "oss:PutObject" }
                { actions_INCLUDES: "oss:PutObjectAcl" }
                { actions_INCLUDES: "oss:ListObjects" }
                { actions_INCLUDES: "oss:GetObjectVersion" }
                { actions_INCLUDES: "oss:*" }
                { actions_INCLUDES: "*" }
              ]
              principals_INCLUDES: "*"
            }
          }
        }
      ]
    }
  ) {...AssetFragment}
}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon