S3 Block Public Access Rejects New Public Policies but Leaves Existing Ones in Place
Overview
With BlockPublicPolicy enabled, S3 rejects any PutBucketPolicy call that would make a bucket public, but it does not remove public policies written while the setting was off, so those older policies stay attached to the bucket.
At a glance
- Symptom
- Account-level or bucket-level Block Public Access is disabled or was never enabled, instantly activating an already-saved wildcard policy.
- Likely cause
- PutBucketPolicy accepts Principal: "*" successfully regardless of current Block Public Access state, since enforcement happens only at data-plane read/write time.
- Impact
- Every object under the affected bucket becomes publicly accessible with no corresponding PutBucketPolicy event for alerting tools to catch.
- Verification signal
- Re-run the detection test and a controlled negative-path test.
- Safe correction
- Lock Block Public Access at the account level via s3control put-public-access-block, deny changes through an SCP, and monitor exposure continuously with IAM Access Analyzer for S3.
- Rollback or recovery
- Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.
The Trap
PutBucketPolicy rejects a resource policy with "Principal": "*" and no scoping conditions only while BlockPublicPolicy is enabled for the bucket or the account. BlockPublicPolicy and BlockPublicAcls act at write time and do not touch policies or ACLs already in place; RestrictPublicBuckets and IgnorePublicAcls act at request time, on GetObject, ListBucket and similar calls.
A wildcard policy written while BlockPublicPolicy was off stays attached after BPA is switched on, held inert only by RestrictPublicBuckets, so a dangerous policy can sit committed and inert for months.
The Default State
Since April 2023 every new bucket, whether created in the console, the CLI, an SDK, CloudFormation or Terraform, gets all four BPA flags set to true unless the template turns them off. Buckets created before then, or whose bucket-level BPA was removed (for example with an aws_s3_bucket_public_access_block resource set to false) for a migration, rely only on the account-level setting.
Account-level BPA is not switched on for you, and many accounts never set it, or disabled it during a one-off migration and never re-enabled it. Engineers writing the wildcard policy see the PutBucketPolicy call succeed and assume the platform would have rejected an unsafe configuration if one existed.
The Blast Radius
Detection tooling built around CloudTrail alerts on PutBucketPolicy events misses the actual exposure entirely, because the triggering action is a later PutAccountPublicAccessBlock or per-bucket BPA change, not a policy write. The moment account-level BPA is disabled, every wildcard policy already resting in the account activates simultaneously across every affected bucket, with no corresponding policy-change event that day.
Static analysis run at deploy time reports the bucket as compliant, since BPA was enabled during the scan, and nobody re-scans after unrelated account-level toggles.
The Lead Mechanic Fix
Treat account-level BPA as a locked control-plane setting rather than a per-project toggle. Apply it explicitly with aws s3control put-public-access-block --account-id ACCOUNT_ID --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true, then deny s3:PutAccountPublicAccessBlock and s3:PutBucketPublicAccessBlock in a Service Control Policy scoped to everyone except a named break-glass role.
Because SCPs cannot inspect the content of a resource policy document, pair this with continuous evaluation from IAM Access Analyzer for S3, which flags external access based on actual policy effect at any time, not just at write time, catching public policies written before BlockPublicPolicy was enforced, which BPA never removes.
Related reading
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
aws s3control put-public-access-block --account-id ACCOUNT_ID --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=trues3:PutAccountPublicAccessBlocks3:PutBucketPublicAccessBlockVerify, roll back or escalate
Verify
Re-run the detection test and a controlled negative-path test. Confirm the unsafe behaviour is blocked while approved traffic still succeeds.
Rollback
Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Last updated
Corrections
- : Corrected during a review of published articles. Details
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Found this useful? Follow KBY for more like it.