Identify public Amazon S3 buckets in AWS Organizations by using Security Hub CSPM
Mourad Cherfaoui, Arun Chandapillai, and Parag Nagwekar, Amazon Web Services
Summary
This pattern shows you how to build a mechanism for identifying public Amazon Simple Storage Service (Amazon S3) buckets in your AWS Organizations accounts. The mechanism uses controls from the AWS Foundational Security Best Practices (FSBP) standard
New Amazon S3 buckets and their objects don't allow public access by default. You can use this pattern in scenarios where you must modify default Amazon S3 configurations based on your organization's requirements. For example, you might have an Amazon S3 bucket that hosts a public-facing website or files that everyone on the internet must be able to read from your Amazon S3 bucket.
Many organizations deploy Security Hub CSPM as a central service to consolidate security findings, including those related to security standards and compliance requirements. You can use other AWS services to detect public Amazon S3 buckets, but this pattern uses an existing Security Hub CSPM deployment with minimal configuration.
Prerequisites and limitations
Prerequisites
An active AWS account in a multi-account setup, with a dedicated Security Hub CSPM administrator account
Security Hub CSPM and AWS Config, enabled in the AWS Region that you want to monitor
NoteYou must enable cross-Region aggregation
in Security Hub CSPM if you want to monitor multiple Regions from a single aggregation Region. Least-privilege AWS Identity and Access Management (IAM) permissions scoped to the tasks in this pattern: in the Security Hub CSPM administrator account, the
securityhub:GetFindingsandsecurityhub:BatchUpdateFindingsactions scoped to the hub Amazon Resource Name (ARN); theevents:PutRule,events:PutTargets,sns:CreateTopic, andsns:Subscribeactions scoped to the ARNs of the rule and topic that you create; read-only access (for example,s3:GetBucketPolicyStatusands3:GetBucketPublicAccessBlock) to the Amazon S3 buckets that you review; ands3:PutBucketPublicAccessBlockonly for the buckets where you need to remove public access. Don't use wildcard (*) actions or resources.
Architecture
The following diagram shows an architecture for using AWS Security Hub CSPM to identify public Amazon S3 buckets.

The diagram shows the following workflow:
Security Hub CSPM monitors the configuration of Amazon S3 buckets in all AWS Organizations accounts (including the administrator account) by using the S3.2 and S3.3 controls from the AWS Foundational Security Best Practices (FSBP) standard. It generates a finding if a bucket is configured as public.
The Security Hub CSPM administrator account accesses the findings (including those for S3.2 and S3.3) from all member accounts.
Security Hub CSPM automatically sends all new findings and all updates to existing findings to EventBridge as Security Hub CSPM Findings - Imported events. This includes events for findings from both the administrator and member accounts.
An EventBridge rule filters on findings from S3.2 and S3.3 that have a
ComplianceStatusofFAILED, a workflow status ofNEW, and aRecordStateofACTIVE.The rule uses event patterns to identify matching events and sends them to an Amazon SNS topic.
An Amazon SNS topic sends the events to its subscribers (through email, for example).
Security analysts designated to receive the email notifications review the Amazon S3 bucket in question.
If the bucket is approved for public access, the security analyst sets the workflow status of the corresponding finding in Security Hub CSPM to
SUPPRESSED. Otherwise, the analyst sets the status toNOTIFIED. This eliminates future notifications for the Amazon S3 bucket and reduces notification noise.If the workflow status is set to
NOTIFIED, the security analyst reviews the finding with the bucket owner to determine if public access is justified and complies with privacy and data protection requirements. The investigation results in either removing public access to the bucket or approving public access. In the latter case, the security analyst sets the workflow status toSUPPRESSED.
The architecture diagram applies to both single Region and cross-Region aggregation deployments. In accounts A, B, and C in the diagram, Security Hub CSPM can belong to the same Region as the administrator account or belong to different Regions if cross-Region aggregation is enabled.
Tools
Amazon EventBridge
is a serverless event bus service that helps you connect your applications with real-time data from a variety of sources. EventBridge delivers a stream of real-time data from your own applications, partner applications, and AWS services. EventBridge routes that data to targets such as Amazon SNS topics and AWS Lambda functions if the data matches user-defined rules. Amazon Simple Notification Service (Amazon SNS)
helps you coordinate and manage the exchange of messages between publishers and clients, including web servers and email addresses. Subscribers receive all messages published to the topics to which they subscribe, and all subscribers to a topic receive the same messages. Amazon Simple Storage Service (Amazon S3)
is a cloud-based object storage service that helps you store, protect, and retrieve any amount of data. AWS Security Hub CSPM
provides a comprehensive view of your security state in AWS. Security Hub CSPM also helps you check your AWS environment against security industry standards and best practices. Security Hub CSPM collects security data from across AWS accounts, services, and supported third-party partner products, and then helps to analyze security trends and identify the highest priority security issues.
Epics
| Task | Description | Skills required |
|---|---|---|
Enable Security Hub CSPM in AWS Organizations accounts. | To enable Security Hub CSPM in the organization accounts where you want to monitor Amazon S3 buckets, see the guidelines from Designating a Security Hub CSPM administrator account (console) | AWS administrator |
(Optional) Enable cross-Region aggregation. | If you want to monitor Amazon S3 buckets in multiple Regions from a single Region, set up cross-Region aggregation | AWS administrator |
Enable the S3.2 and S3.3 controls for the FSBP security standard. | You must enable S3.2 and S3.3 controls for the FSBP security standard.
| AWS administrator |
| Task | Description | Skills required |
|---|---|---|
Configure the Amazon SNS topic and email subscription. |
| AWS administrator |
Configure the EventBridge rule. |
| AWS administrator |
Troubleshooting
| Issue | Solution |
|---|---|
I have an Amazon S3 bucket with public access enabled, but I'm not getting email notifications for it. | This could be because the bucket was created in another Region and cross-Region aggregation is not enabled in the Security Hub CSPM administrator account. To resolve this issue, enable cross-Region aggregation or implement this pattern's solution in the Region where your Amazon S3 bucket currently resides. |
Related resources
What is AWS Security Hub CSPM?
(Security Hub CSPM documentation) AWS Foundational Security Best Practices (FSBP) standard
(Security Hub CSPM documentation) Managing AWS Security Hub CSPM accounts with AWS Organizations
(Security Hub CSPM documentation) Security best practices for Amazon S3
(Amazon S3 documentation)
Additional information
Workflow for monitoring public Amazon S3 buckets
The following workflow illustrates how you can monitor the public Amazon S3 buckets in your organization. The workflow assumes that you completed the steps in the Configure the Amazon SNS topic and email subscription story of this pattern.
You receive an email notification when an Amazon S3 bucket is configured with public access.
If the bucket is approved for public access, set the workflow status of the corresponding finding to
SUPPRESSEDin the Security Hub CSPM administrator account. This prevents Security Hub CSPM from issuing further notifications for this bucket and helps reduce duplicate alerts.If the bucket isn't approved for public access, set the workflow status of the corresponding finding in the Security Hub CSPM administrator account to
NOTIFIED. This prevents Security Hub CSPM from issuing further notifications for this bucket and helps reduce unnecessary alerts.
If the bucket might contain sensitive data, turn off public access immediately until the review is completed. If you turn off public access, then Security Hub CSPM changes the workflow status to
RESOLVED. Then, email notifications for the bucket stop.Find the user who configured the bucket as public (for example, by using AWS CloudTrail) and start a review. The review results in either removing public access to the bucket or approving public access. If public access is approved, then set the workflow status of the corresponding finding to
SUPPRESSED.
Security considerations
Grant only the minimum IAM permissions described in the Prerequisites section. Don't use service-wide wildcard actions (such as
securityhub:*) or wildcard resources.This pattern doesn't require you to disable Security Hub CSPM, AWS Config, or any logging controls. Keep these services enabled in all accounts and Regions to help maintain continuous detection of public Amazon S3 buckets.
Suppress a finding only after the bucket owner and security team have documented approval for public access, and review suppressed findings periodically.
Restrict the Amazon SNS topic policy so that only the Amazon EventBridge rule in your account can publish to it (for example, by using an
aws:SourceArncondition), and encrypt the topic with AWS KMS.