Overview
Buckets should almost never be publicly accessible (excepting when using them to host public static websites). When configured to allow public access, anyone can read the data (objects) without having to perform any authentication or authorization. This can lead to data leaks and can potentially generate considerable costs.
If you want to grant access to certain objects to certain users, you can leverage signed URLs:
AWS
Azure
Google Cloud
Alibaba
If you want to configure the bucket for static website hosting, we recommend adding a CDN in front of it.
- https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-serve-static-website/
- https://learn.microsoft.com/en-us/azure/storage/blobs/static-website-content-delivery-network
- https://cloud.google.com/storage/docs/hosting-static-website
- https://www.alibabacloud.com/help/en/object-storage-service/latest/use-cdn-to-accelerate-access-to-oss
Remediation guidance
AWS
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html
Azure
- https://learn.microsoft.com/en-us/azure/storage/blobs/anonymous-read-access-prevent
Google Cloud
- https://cloud.google.com/storage/docs/access-control#public_access_prevention
Alibaba Cloud
- https://www.alibabacloud.com/help/en/object-storage-service/latest/access-and-control-overview
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.
Alibaba Cloud
Use Resource Directory guardrails, account baselines, and IaC modules so the secure setting is applied consistently across environments.
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.
Operational rollout
- Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
- Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
- Re-scan and track approved exceptions with an owner and expiry date.
Query logic
These are the stored checks tied to this control.
Publicly Readable AWS Buckets
Connectors
Covered asset types
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", "FULL_CONTROL"] } } { bucketPolicy: { statements_SOME: { effect: "Allow" OR: [ { actions_INCLUDES: "s3:GetObject" } { actions_INCLUDES: "s3:ListObjects" } { actions_INCLUDES: "s3:ListObjectsV2" } { actions_INCLUDES: "s3:*" } { actions_INCLUDES: "*" } ] principals_INCLUDES: "AWS|*" } } } ] } ) {...AssetFragment} } Publicly Readable Azure Blob Containers
Connectors
Covered asset types
Expected check: eq []
{
blobContainers(
where: {
cloudProvider: "azure"
publicAccessBlocked: false
publicAccess_IN: ["Blob", "Container"]
}
) {...AssetFragment}
}
Publicly Readable Alibaba Buckets
Connectors
Covered asset types
Expected check: eq []
{ buckets( where: { cloudProvider: "alibaba" publicAccessBlocked: false OR: [ { acl_IN: ["public-read"] } { bucketPolicy: { statements_SOME: { effect: "Allow" OR: [ { actions_INCLUDES: "oss:GetObject" } { actions_INCLUDES: "oss:ListObjects" } { actions_INCLUDES: "oss:GetObjectVersion" } { actions_INCLUDES: "oss:*" } { actions_INCLUDES: "*" } ] principals_INCLUDES: "*" } } } ] } ) {...AssetFragment} } Publicly Readable Google Cloud Buckets
Connectors
Covered asset types
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.*" } ] } } } ) {...AssetFragment} }
Alibaba Cloud
AWS
Google Cloud
Microsoft Azure