S3 Public-Access Auditor
An AWS CloudOps agent skill that analyzes S3 bucket configurations (Block Public
Access settings, ACLs, and bucket policy snippets) to determine which buckets
are publicly accessible, classify each bucket's exposure level, and provide
specific remediation guidance.
Activation keywords
audit, public access, BPA, Block Public Access, bucket policy, ACL, AllUsers,
AuthenticatedUsers, Principal:"*", s3:GetObject, s3:PutObject, Access Point,
Multi-Region Access Point, MRAP, Object Ownership, BucketOwnerEnforced,
Object Writer, aws:sourceVpce, aws:sourceIp, public read, public write,
s3 exposure, data leak, bucket security, compliance check, bulk bucket audit.
Invocation contract (hard requirement)
When this skill is invoked with bucket configuration input (BPA settings,
ACL JSON, bucket-policy JSON, or any S3 bucket descriptor), the agent MUST
respond with the four-line per-bucket block defined in §"Output format"
using the literal all-caps labels BUCKET:, VERDICT:, REASON:,
REMEDIATION:. Do NOT preface the block with prose, headings, or
disclaimers — emit the block as the first lines of the response. This
contract is what assertion-based evals and downstream parsers rely on;
deviating from the literal labels breaks automation silently.
Reasoning framework (why the procedure is ordered this way)
S3 has FIVE independent access-control planes that are evaluated by AWS in a
fixed precedence — the order of the procedure below mirrors that precedence
so the first matching rule is the one AWS would actually enforce:
Block Public Access (BPA) — a hard gate, evaluated first. When all 4 BPA
settings are True, AWS suppression happens at the authorization layer
BEFORE ACLs, policies, or access-point policies are evaluated. A public ACL
still appears in get-bucket-acl output but is silently ignored; a
Principal: "*" policy still parses but is restricted to principals within
the owner account. So BPA is authoritative — checking it first avoids
false positives on buckets that look exposed but are not.
Object Ownership — BucketOwnerEnforced (the default since April 2022)
disables ALL ACLs on the bucket and any ACL grants present are silently
ignored. If this value is set, the ACL plane is moot and ACL inspection
becomes a no-op — but the bucket policy and access-point policies still
apply. See §"Object Ownership setting".
Bucket policy — evaluated next. A bucket policy is attached JSON; even
with BPA off, an Allow with Principal: "*" and no restrictive condition
is a direct public read/write path. This is the most common leak pattern.
ACL — legacy cross-account / public grants via the ACL API. With BPA
off and Object Ownership permitting ACLs, an AllUsers READ grant is a
public read path that the bucket policy does not override (ACLs and
policies are evaluated independently — the effective permission is the
union of both).
Access Points (and Multi-Region Access Points, MRAP) — each Access
Point has its OWN policy that is UNIONED with the bucket policy for
requests addressed through the AP ARN (arn:aws:s3:<region>:<acct>:accesspoint/<name>/...).
A "SAFE" bucket can be fully exposed via a single permissive AP. See
§"Access Points and MRAP".
Condition strength — only evaluated when a Principal: "*" statement
(on bucket OR access-point policy) has a Condition. A restrictive
condition narrows access, but conditions vary in strength (see
§"Condition strength matrix" and the full reference at
references/condition-strength-matrix.md).
The order matters because each layer can MASK or REVEAL the next. The judge
should classify by the first rule that matches, in this order.
Classification logic (apply in order — first match wins)
BPA fully enabled at bucket level (all 4 settings:
BlockPublicAcls, IgnorePublicAcls, BlockPublicPolicy,
RestrictPublicBuckets = True). The bucket is SAFE regardless of
ACLs or policies. Bucket-level BPA is authoritative for that bucket
independent of account-level BPA — see §"Account-level vs bucket-level
BPA interaction" for the truth table. Cite "Rule 1: BPA authoritative".
PUBLIC via unrestricted wildcard policy. BPA is not fully enabled AND
any statement in the bucket policy OR any access-point policy for the
bucket has ALL of:
Effect: Allow
Principal of "*", {"AWS": "*"}, or any principal that resolves to
all principals (including "*" nested under Service or Federated)
Action including at least one of: s3:GetObject, s3:*,
s3:Get*, s3:Put*, s3:List*, s3:DeleteObject*,
s3:PutBucketPolicy, s3:PutBucketAcl, s3:PutObjectAcl,
s3:GetObjectVersion
- The
Resource covers the object namespace
(arn:aws:s3:::bucket/* or arn:aws:s3:<region>:<acct>:accesspoint/<name>/object/*)
or the bucket / AP namespace itself — both are exploitable; object
namespace is read/write of objects, bucket/AP namespace is config
manipulation
- No
Condition OR a condition containing only weak keys (see
§"Condition strength matrix" — a weak-conditioned statement is
treated as PUBLIC, not AMBIGUOUS)
Cite "Rule 2: unrestricted wildcard Allow". Severity escalation:
if the action set includes write-side actions
(s3:PutObject, s3:DeleteObject, s3:PutBucketPolicy,
s3:PutBucketAcl, s3:PutObjectAcl, s3:*), escalate severity to
CRITICAL in the reason (write open bucket → ransomware /
data-destruct attack surface). Read-only (s3:GetObject /
s3:Get* / s3:List*) stays at HIGH (data exfiltration).
Cross-plane escalation: if the wildcard Allow lives on an Access
Point policy rather than the bucket policy, note "exposure via Access
Point <name> — reachable through the AP ARN regardless of bucket
policy". See §"Access Points and MRAP".
PUBLIC via legacy ACL. BPA is not fully enabled AND Object Ownership
permits ACLs (see §"Object Ownership setting") AND any ACL grant
targets AllUsers (http://acs.amazonaws.com/groups/global/AllUsers)
OR AuthenticatedUsers
(http://acs.amazonaws.com/groups/global/AuthenticatedUsers) —
AuthenticatedUsers means "any AWS account holder", which is
effectively public (anyone can create a free AWS account).
READ → public read; WRITE → public write (CRITICAL).
Cite "Rule 3: legacy ACL grant". If Object Ownership is
BucketOwnerEnforced, ACLs are disabled and any ACL grant in the input
is a no-op — DO NOT fire Rule 3; fall through to Rule 5 (or note the
stale grant as informational).
AMBIGUOUS (restricted wildcard policy). BPA is not fully enabled AND
a Principal: "*" Allow exists BUT the Condition contains at least
one STRONG condition key (see matrix). The bucket is not directly
public, but a policy edit or condition removal could expose it. Cite
"Rule 4: condition-restricted wildcard — fragile posture".
SAFE (BPA off, no public configs). BPA is not fully enabled but
no public ACLs, no public policy statements (bucket OR access-point),
no website-config exposure (see §"Website-hosting check"). Cite
"Rule 5: clean config, recommend BPA as defense-in-depth".
Account-level vs bucket-level BPA interaction
BPA exists at two scopes and they are NOT inherited — each is independently
evaluated, and the EFFECTIVE BPA state for a bucket is the most-restrictive
combination of both scopes per-setting:
| Setting |
Effective value when bucket=A, account=B |
BlockPublicAcls |
True if EITHER scope is True |
IgnorePublicAcls |
True if EITHER scope is True |
BlockPublicPolicy |
True if EITHER scope is True |
RestrictPublicBuckets |
True if EITHER scope is True |
In other words: each setting is a logical OR across scopes — enabling a
setting at EITHER scope is sufficient; the more-restrictive scope wins.
Moved to references/advanced-patterns.md — the four account-vs-bucket BPA postures and what each means for classification.
Load that reference on demand before executing this section.
Always state which scope(s) are set in the verdict reason so the operator
knows where to apply the remediation. When auditing input that omits the
account-level state, ASSUME account-level BPA is OFF (worst-case) and
note the assumption explicitly — do not silently infer protection.
Object Ownership setting (s3:GetBucketOwnershipControls)
Moved to references/advanced-patterns.md — ObjectWriter / BucketOwnerPreferred / BucketOwnerEnforced and Rule 3 gating.
Load that reference on demand before executing this section.
Access Points and Multi-Region Access Points (MRAP)
Each S3 Access Point has its OWN policy and is addressable via a separate
ARN (arn:aws:s3:<region>:<acct>:accesspoint/<name>). Requests made via
the AP ARN are evaluated against the UNION of the bucket policy and the
AP policy — so a permissive AP policy exposes the bucket even when the
bucket policy is restrictive. Multi-Region Access Points (MRAP) add a
single global ARN routed across regions, and an MRAP policy evaluated the
same way.
Moved to references/diagnostic-commands.md — list/get AP policies per region, apply Rules 2/4 to AP policies, MRAP policy fetch.
Load that reference on demand before executing this section.
Procedural enumeration (large-account bulk audit)
For accounts with hundreds or thousands of buckets, the audit must
enumerate safely before classifying. Use this procedure:
Moved to references/diagnostic-commands.md — paginated bucket listing, account BPA capture, parallel 5-input capture, per-region AP enumeration.
Load that reference on demand before executing this section.
Multi-statement and malformed input handling
Moved to references/advanced-patterns.md — statement iteration, Deny-condition pitfalls, NotAction/NotPrincipal, cross-policy union, malformed JSON, object ACLs.
Load that reference on demand before executing this section.
Condition strength matrix (summary)
When evaluating a Principal: "*" Allow with a Condition, classify the
condition to choose between Rule 2 (PUBLIC) and Rule 4 (AMBIGUOUS). The
full table — including less-common keys (aws:CalledViaFirst,
aws:MultiFactorAuthAge, s3:ExistingObjectTag, kms:ViaService,
aws:PrincipalOrgID, aws:PrincipalArn, VPC-endpoint service
exceptions) and the IfExists semantics for each — lives in
references/condition-strength-matrix.md. Inline summary:
STRONG condition keys → AMBIGUOUS (Rule 4):
aws:sourceVpce / aws:SourceVpce (VPC Endpoint ID, StringEquals) —
request must come through the named endpoint; not forgeable by the
caller.
aws:sourceVpc / aws:SourceVpc (VPC ID, StringEquals) — request
must originate in the named VPC.
aws:SourceAccount / aws:SourceOrgID / aws:PrincipalOrgID with
StringEquals — restricts to a specific AWS account or Organizations
org.
aws:sourceIp (aws:SourceIp, IpAddress) restricted to a true
private CIDR (RFC1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16)
or a documented corporate range — see §"CIDR nuance table".
WEAK condition keys → still PUBLIC (Rule 2):
aws:Referer (StringLike/StringEquals on Referer header) — trivially
forgeable by any HTTP client; provides NO real access control.
aws:UserAgent — same; forgeable client-side.
aws:sourceIp with 0.0.0.0/0 (or omitted — equivalent to /0) —
covers the entire internet; treat as no restriction.
aws:EpochTime / s3:authType used alone — narrow the channel but
not the principal.
- Any condition key wrapped in
IfExists — weakens the assertion; treat
per the underlying key but flag the IfExists semantics (see reference).
CIDR nuance table for aws:sourceIp
Moved to references/condition-strength-matrix.md — verdict per CIDR incl. /0, RFC1918, CGNAT, TEST-NET, split-halves bypass.
Load that reference on demand before executing this section.
Website-hosting check
Moved to references/advanced-patterns.md — website+BPA=SAFE(broken), website+public ACL/policy=PUBLIC amplification.
Load that reference on demand before executing this section.
Output format (per bucket) — MANDATORY literal labels
When invoked with bucket configuration input, your ENTIRE response MUST be
the per-bucket block below (one block per bucket). The four labels are
case-sensitive all-caps keywords — write them EXACTLY as shown. Do NOT
substitute Verdict, Reason, **VERDICT**, ### Verdict, or any
markdown variant. Do NOT write a preamble ("Based on the configuration…"),
an "Audit Findings" heading, or a trailing "Detailed Analysis" section.
Start with BUCKET: and stop after the REMEDIATION: line. A short
clarifying paragraph MAY follow the block if needed, but the block itself
MUST be the first thing in the response and MUST contain all four labels.
BUCKET: <name>
VERDICT: PUBLIC | SAFE | AMBIGUOUS
REASON: <1-2 sentences citing the specific config — include which rule number fired and the severity for PUBLIC>
REMEDIATION: <specific action, or "None required" if safe>
Worked example (copy the shape exactly):
BUCKET: logs-archive-2024
VERDICT: PUBLIC
REASON: Rule 3 (legacy ACL grant) — AllUsers READ grant; HIGH severity (public read of log archive data).
REMEDIATION: Enable BPA (all 4 settings), remove the AllUsers ACL grant (set ACL to private).
For a multi-bucket audit, emit one block per bucket, separated by a blank
line, then an optional summary table. Each block MUST contain the four
mandatory labels (BUCKET, VERDICT, REASON, REMEDIATION) — even if
REMEDIATION is "None required".
NEVER (anti-patterns)
NEVER classify a bucket as PUBLIC when BPA is fully enabled at the
bucket level (all 4 settings True). Bucket-level BPA is authoritative
for that bucket regardless of account-level BPA state — even a
Principal: "*" policy is restricted to in-account principals. A
false-positive PUBLIC on a BPA-protected bucket causes unnecessary
ticket churn and erodes trust in the auditor.
NEVER classify a bucket as SAFE when BPA is off and a policy grants
s3:GetObject (or any read/write action in the §"Rule 2" list) to
Principal: "*" with no restrictive condition. This is the most
common S3 data-leak pattern.
NEVER assume a private ACL means the bucket is safe when BPA is
off. The ACL and the bucket policy are independent — a public policy
overrides a private ACL because AWS unions the two. Check BOTH.
NEVER classify a Principal: "*" Allow with a strong restrictive
condition (aws:sourceVpce, aws:sourceVpc, aws:SourceAccount)
as PUBLIC. The condition narrows access to a known network or
account — the correct verdict is AMBIGUOUS. PUBLIC means anyone on
the internet.
NEVER treat a Principal: "*" Allow with a WEAK condition
(aws:Referer, aws:UserAgent) as AMBIGUOUS. These keys are
forgeable client-side and provide no real restriction — classify as
PUBLIC. This is the inverse mistake of the previous rule.
NEVER recommend enabling only some BPA settings. Each setting blocks
a different vector: BlockPublicAcls blocks new public ACLs but not
policies; BlockPublicPolicy blocks new public policies but ignores
legacy ACLs; IgnorePublicAcls neutralizes existing ACLs;
RestrictPublicBuckets restricts the blast radius of public policies
already attached. Half-enabled BPA is a false sense of security.
NEVER ignore AuthenticatedUsers
(http://acs.amazonaws.com/groups/global/AuthenticatedUsers). Any
AWS account holder can read/write — anyone can create a free-tier
account. Treat identically to AllUsers for severity purposes.
NEVER ignore the Principal: "*" in a NotAction statement. An
Allow with Principal: "*", NotAction: "s3:Delete*", and no
condition grants every action EXCEPT Delete to the world. Easy to
miss in manual review — the skill must flag it as PUBLIC.
NEVER treat static website hosting as automatically public. The
feature does not grant access; it requires an ACL or policy to do
so. Classify by the underlying ACL/policy, then note whether
website hosting amplifies the exposure.
NEVER recommend deleting the bucket policy as the first remediation
step without first capturing the policy content (e.g., aws s3api get-bucket-policy --output json > backup.json). Some policies are
load-bearing for application access; a destructive remediation
must be reversible.
NEVER trust a Deny with Principal: "*" as a positive signal of
hardening without verifying the Deny's Condition. A Deny with
aws:SecureTransport: false enforces TLS but says nothing about
public exposure. A Deny with aws:MultiFactorAuthPresent=false does
not restrict the principal set. A Deny with no condition DOES block
all access — read the full statement.
NEVER classify a bucket as SAFE when it has a permissive Access Point
or Multi-Region Access Point policy, even if the bucket policy is
restrictive. Requests addressed through the AP ARN bypass the bucket
policy for that surface. Always enumerate APs (list-access-points)
and audit their policies.
NEVER recommend enabling only one BPA setting. A common pitfall is
enabling BlockPublicAcls alone and concluding the bucket is safe —
BlockPublicPolicy may still be False, leaving an existing public
policy fully active. Verify all 4 settings are True at the chosen
scope before declaring protection.
NEVER treat a partial-BPA bucket (e.g., 3 of 4 settings True) as
fully BPA-protected. Per the §"Account-level vs bucket-level BPA
interaction" truth table, each setting is independent; the missing
setting leaves its specific vector open. Fall through to the
policy/ACL rules and flag the partial-BPA gap explicitly.
NEVER infer account-level BPA state from a bucket-level reading (or
vice versa). The two scopes are NOT inherited. If the input only
provides one scope, ASSUME the other is OFF (worst case) and flag
the assumption — silently inferring protection is the canonical
cause of false-SAFE classifications.
NEVER rely on aws:sourceIp with 0.0.0.0/0 (or a paired
0.0.0.0/1 + 128.0.0.0/1) as a real restriction. The condition
matches every IPv4 address; classify as PUBLIC (Rule 2). Same for
any IP-list condition containing even a single /0 entry — AWS
ORs the list, so one open entry widens access.
NEVER fire Rule 3 (legacy ACL) when Object Ownership is
BucketOwnerEnforced. ACLs are disabled at the API layer on these
buckets — any ACL grant in get-bucket-acl output is a cosmetic
leftover. Note the stale grant but do not classify as PUBLIC via ACL.
NEVER treat the bucket policy in isolation when Access Points are
in scope. The effective permission for AP-addressed requests is the
union of bucket policy + AP policy; a restrictive bucket policy
does NOT restrict AP-addressed requests.
NEVER deviate from the four-line output block. Substituting
Verdict / **VERDICT** / ### Verdict: / Conclusion: (or any
prose variant) for the literal VERDICT: label silently breaks
downstream parsers and assertion-based evals. Same for REASON:
and REMEDIATION:. The labels are uppercase, end with a colon,
and appear on their own line. Even when REMEDIATION is "None
required", the label MUST be present.
NEVER preface the verdict block with a preamble like "Based on the
configuration…" or an "### Audit Findings" heading. The first
non-blank line of the response MUST be BUCKET: <name>. A short
clarifying section may FOLLOW the block, but the block itself must
lead the response.
Pre-flight safety checks (run before any remediation CLI)
- Confirm the bucket exists in the target account/region:
aws s3api head-bucket --bucket <name> — fail closed (skip
remediation) if it returns an error.
- Capture current state for rollback:
aws s3api get-bucket-policy --bucket <name> --output json > /tmp/<name>-policy-backup-$(date +%s).json
and
aws s3api get-bucket-acl --bucket <name> --output json > /tmp/<name>-acl-backup-$(date +%s).json
BEFORE any modification.
- Prefer additive changes (enable BPA) over destructive changes (delete
policy). Enabling BPA is reversible by setting all 4 back to False;
deleting a policy may lose application access intent.
- For write-open buckets (PUBLIC with
s3:PutObject/s3:DeleteObject),
treat as incident-response — enable BPA IMMEDIATELY before capturing
full forensic state, because every second of write-open exposure is
data destruction risk. Capture state AFTER containing.
Remediation guidance
Moved to references/bpa-settings-and-cli-commands.md — action plans for PUBLIC read/write/ACL, AMBIGUOUS, SAFE postures.
Load that reference on demand before executing this section.
Remediation for Access-Point-exposed buckets
Moved to references/bpa-settings-and-cli-commands.md — AP policy tightening, account BPA, CloudFront OAC fronting, MRAP propagation.
Load that reference on demand before executing this section.
Remediation for partial-BPA buckets
Moved to references/bpa-settings-and-cli-commands.md — same-scope completion, IgnorePublicAcls inertness note, BucketOwnerEnforced fix.
Load that reference on demand before executing this section.
Adjacent postures worth flagging (not part of the verdict)
Moved to references/advanced-patterns.md — KMS key-policy backdoor, Object Lambda APs, VPC endpoint policies.
Load that reference on demand before executing this section.
Recent AWS features (2024-2026)
Moved to references/advanced-patterns.md — directory buckets, Access Grants, S3 Tables, Express One Zone, versioning defaults.
Load that reference on demand before executing this section.
References
references/bpa-settings-and-cli-commands.md — full BPA enablement
CLI commands (with pre-flight backup), account-level vs bucket-level
detail, CloudFront OAC migration snippet, copy-pasteable remediation.
references/condition-strength-matrix.md — exhaustive table of
strong vs weak condition keys (including rare keys:
aws:CalledViaFirst, aws:MultiFactorAuthAge, s3:authType,
s3:ExistingObjectTag, kms:ViaService), IfExists semantics, and
worked examples for each.
Section taxonomy (CloudOps auditor pattern)
Moved to references/advanced-patterns.md — the 17-section canonical order this skill follows.
Load that reference on demand before executing this section.
References (load on demand)
- references/bpa-settings-and-cli-commands.md — full BPA enablement/verification CLI, account vs bucket scope, ACL/policy removal, CloudFront OAC, per-verdict remediation guidance.
- references/condition-strength-matrix.md — exhaustive strong/weak condition-key table, IfExists semantics, CIDR nuance table, worked examples.
- references/diagnostic-commands.md — bulk-audit enumeration commands and Access-Point/MRAP audit CLI.
- references/advanced-patterns.md — BPA scope implications, Object Ownership, edge-case handling, website check, adjacent postures, recent AWS features.
Domain
AWS CloudOps / S3 Security & Compliance.
AWS documentation
1---2name: s3-public-access-auditor3description: 'Audits S3 bucket configurations (Block Public Access settings, ACLs, bucket policies, Access Points, and Object Ownership) to determine which buckets are publicly accessible and provides specific remediation guidance. Use when reviewing S3 bucket security, checking for public access exposure, validating BPA settings, auditing bucket ACLs/policies for compliance, or inventorying exposure across hundreds of buckets in an account. Triggers: S3, bucket, public access, BPA, Block Public Access, bucket policy, ACL, AllUsers, AuthenticatedUsers, Principal:*, s3:GetObject, s3:PutObject, Access Point, Multi-Region Access Point, MRAP, Object Ownership, BucketOwnerEnforced, Object Writer, sourceIp, aws:sourceVpce, public read, public write, s3 exposure, data leak, bucket security, compliance check, bulk bucket audit.'4license: Apache-2.05compatibility: Requires an LLM agent runtime (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI calls needed for analysis — the skill reasons over provided config text. For live remediation, AWS CLI v2 with s3api/s3control/accesspoints access.6metadata:7 source: https://skillmd.com/skills/jhkchan/s3-public-access-auditor8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '2'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Storage15 verdict_shape: PUBLIC | SAFE | AMBIGUOUS16 version: 0.4.017 author: Jacky Chan — AWS Community Builder18 tags: aws, s3, cloudops, security, public-access, bpa, bucket-policy, acl, audit, compliance19 dependencies: aws-orchestrator20 keywords: aws, s3, cloudops, security, public-access, bpa, block-public-access, bucket-policy, acl, audit, compliance, data-leak21 when_to_use: Invoke when the user supplies S3 bucket config (BPA settings, ACL JSON, bucket-policy JSON, Access Point ARN/policy, Object Ownership value) and asks to classify public exposure for one or many buckets; when triaging a potential S3 data-leak alert (GuardDuty finding, MACIE finding, security-hub rule); when hardening an account by inventorying all buckets for BPA/ACL/policy posture; or when validating that intended-public buckets (static website / CloudFront origin) are not over-exposed. Do NOT invoke for non-S3 storage (EBS/EFS/FSx) or for object-level encryption/KMS questions unless they affect the public-access verdict.22---2324# S3 Public-Access Auditor2526An AWS CloudOps agent skill that analyzes S3 bucket configurations (Block Public27Access settings, ACLs, and bucket policy snippets) to determine which buckets28are publicly accessible, classify each bucket's exposure level, and provide29specific remediation guidance.3031## Activation keywords3233audit, public access, BPA, Block Public Access, bucket policy, ACL, AllUsers,34AuthenticatedUsers, Principal:"*", s3:GetObject, s3:PutObject, Access Point,35Multi-Region Access Point, MRAP, Object Ownership, BucketOwnerEnforced,36Object Writer, aws:sourceVpce, aws:sourceIp, public read, public write,37s3 exposure, data leak, bucket security, compliance check, bulk bucket audit.3839## Invocation contract (hard requirement)4041When this skill is invoked with bucket configuration input (BPA settings,42ACL JSON, bucket-policy JSON, or any S3 bucket descriptor), the agent MUST43respond with the four-line per-bucket block defined in §"Output format"44using the literal all-caps labels `BUCKET:`, `VERDICT:`, `REASON:`,45`REMEDIATION:`. Do NOT preface the block with prose, headings, or46disclaimers — emit the block as the first lines of the response. This47contract is what assertion-based evals and downstream parsers rely on;48deviating from the literal labels breaks automation silently.4950## Reasoning framework (why the procedure is ordered this way)5152S3 has FIVE independent access-control planes that are evaluated by AWS in a53fixed precedence — the order of the procedure below mirrors that precedence54so the first matching rule is the one AWS would actually enforce:55561. **Block Public Access (BPA)** — a hard gate, evaluated first. When all 4 BPA57 settings are `True`, AWS suppression happens at the authorization layer58 BEFORE ACLs, policies, or access-point policies are evaluated. A public ACL59 still appears in `get-bucket-acl` output but is silently ignored; a60 `Principal: "*"` policy still parses but is restricted to principals within61 the owner account. So BPA is *authoritative* — checking it first avoids62 false positives on buckets that look exposed but are not.63642. **Object Ownership** — `BucketOwnerEnforced` (the default since April 2022)65 disables ALL ACLs on the bucket and any ACL grants present are silently66 ignored. If this value is set, the ACL plane is moot and ACL inspection67 becomes a no-op — but the bucket policy and access-point policies still68 apply. See §"Object Ownership setting".69703. **Bucket policy** — evaluated next. A bucket policy is attached JSON; even71 with BPA off, an `Allow` with `Principal: "*"` and no restrictive condition72 is a direct public read/write path. This is the most common leak pattern.73744. **ACL** — legacy cross-account / public grants via the ACL API. With BPA75 off and Object Ownership permitting ACLs, an `AllUsers` READ grant is a76 public read path that the bucket policy does not override (ACLs and77 policies are evaluated independently — the effective permission is the78 union of both).79805. **Access Points (and Multi-Region Access Points, MRAP)** — each Access81 Point has its OWN policy that is UNIONED with the bucket policy for82 requests addressed through the AP ARN (`arn:aws:s3:<region>:<acct>:accesspoint/<name>/...`).83 A "SAFE" bucket can be fully exposed via a single permissive AP. See84 §"Access Points and MRAP".85866. **Condition strength** — only evaluated when a `Principal: "*"` statement87 (on bucket OR access-point policy) has a `Condition`. A restrictive88 condition narrows access, but conditions vary in strength (see89 §"Condition strength matrix" and the full reference at90 `references/condition-strength-matrix.md`).9192The order matters because each layer can MASK or REVEAL the next. The judge93should classify by the first rule that matches, in this order.9495## Classification logic (apply in order — first match wins)96971. **BPA fully enabled at bucket level** (all 4 settings:98 `BlockPublicAcls`, `IgnorePublicAcls`, `BlockPublicPolicy`,99 `RestrictPublicBuckets` = `True`). The bucket is **SAFE** regardless of100 ACLs or policies. Bucket-level BPA is authoritative for that bucket101 independent of account-level BPA — see §"Account-level vs bucket-level102 BPA interaction" for the truth table. Cite "Rule 1: BPA authoritative".1031042. **PUBLIC via unrestricted wildcard policy.** BPA is not fully enabled AND105 any statement in the bucket policy OR any access-point policy for the106 bucket has ALL of:107 - `Effect: Allow`108 - `Principal` of `"*"`, `{"AWS": "*"}`, or any principal that resolves to109 all principals (including `"*"` nested under `Service` or `Federated`)110 - `Action` including at least one of: `s3:GetObject`, `s3:*`,111 `s3:Get*`, `s3:Put*`, `s3:List*`, `s3:DeleteObject*`,112 `s3:PutBucketPolicy`, `s3:PutBucketAcl`, `s3:PutObjectAcl`,113 `s3:GetObjectVersion`114 - The `Resource` covers the object namespace115 (`arn:aws:s3:::bucket/*` or `arn:aws:s3:<region>:<acct>:accesspoint/<name>/object/*`)116 or the bucket / AP namespace itself — both are exploitable; object117 namespace is read/write of objects, bucket/AP namespace is config118 manipulation119 - **No `Condition`** OR a condition containing only weak keys (see120 §"Condition strength matrix" — a weak-conditioned statement is121 treated as PUBLIC, not AMBIGUOUS)122123 Cite "Rule 2: unrestricted wildcard Allow". **Severity escalation:**124 if the action set includes write-side actions125 (`s3:PutObject`, `s3:DeleteObject`, `s3:PutBucketPolicy`,126 `s3:PutBucketAcl`, `s3:PutObjectAcl`, `s3:*`), escalate severity to127 **CRITICAL** in the reason (write open bucket → ransomware /128 data-destruct attack surface). Read-only (`s3:GetObject` /129 `s3:Get*` / `s3:List*`) stays at **HIGH** (data exfiltration).130 **Cross-plane escalation:** if the wildcard Allow lives on an Access131 Point policy rather than the bucket policy, note "exposure via Access132 Point `<name>` — reachable through the AP ARN regardless of bucket133 policy". See §"Access Points and MRAP".1341353. **PUBLIC via legacy ACL.** BPA is not fully enabled AND Object Ownership136 permits ACLs (see §"Object Ownership setting") AND any ACL grant137 targets `AllUsers` (`http://acs.amazonaws.com/groups/global/AllUsers`)138 OR `AuthenticatedUsers`139 (`http://acs.amazonaws.com/groups/global/AuthenticatedUsers`) —140 `AuthenticatedUsers` means "any AWS account holder", which is141 effectively public (anyone can create a free AWS account).142 `READ` → public read; `WRITE` → public write (CRITICAL).143 Cite "Rule 3: legacy ACL grant". If Object Ownership is144 `BucketOwnerEnforced`, ACLs are disabled and any ACL grant in the input145 is a no-op — DO NOT fire Rule 3; fall through to Rule 5 (or note the146 stale grant as informational).1471484. **AMBIGUOUS (restricted wildcard policy).** BPA is not fully enabled AND149 a `Principal: "*"` Allow exists BUT the `Condition` contains at least150 one STRONG condition key (see matrix). The bucket is not directly151 public, but a policy edit or condition removal could expose it. Cite152 "Rule 4: condition-restricted wildcard — fragile posture".1531545. **SAFE (BPA off, no public configs).** BPA is not fully enabled but155 no public ACLs, no public policy statements (bucket OR access-point),156 no website-config exposure (see §"Website-hosting check"). Cite157 "Rule 5: clean config, recommend BPA as defense-in-depth".158159## Account-level vs bucket-level BPA interaction160161BPA exists at two scopes and they are NOT inherited — each is independently162evaluated, and the EFFECTIVE BPA state for a bucket is the most-restrictive163combination of both scopes per-setting:164165| Setting | Effective value when bucket=A, account=B |166|--------------------------|------------------------------------------|167| `BlockPublicAcls` | True if EITHER scope is True |168| `IgnorePublicAcls` | True if EITHER scope is True |169| `BlockPublicPolicy` | True if EITHER scope is True |170| `RestrictPublicBuckets` | True if EITHER scope is True |171172In other words: each setting is a logical OR across scopes — enabling a173setting at EITHER scope is sufficient; the more-restrictive scope wins.174Moved to [references/advanced-patterns.md](references/advanced-patterns.md#bpa-scope-interaction-practical-implications) — the four account-vs-bucket BPA postures and what each means for classification.175Load that reference on demand before executing this section.176177Always state which scope(s) are set in the verdict reason so the operator178knows where to apply the remediation. When auditing input that omits the179account-level state, ASSUME account-level BPA is OFF (worst-case) and180note the assumption explicitly — do not silently infer protection.181182## Object Ownership setting (`s3:GetBucketOwnershipControls`)183184Moved to [references/advanced-patterns.md](references/advanced-patterns.md#object-ownership-setting-s3getbucketownershipcontrols) — ObjectWriter / BucketOwnerPreferred / BucketOwnerEnforced and Rule 3 gating.185Load that reference on demand before executing this section.186187## Access Points and Multi-Region Access Points (MRAP)188189Each S3 Access Point has its OWN policy and is addressable via a separate190ARN (`arn:aws:s3:<region>:<acct>:accesspoint/<name>`). Requests made via191the AP ARN are evaluated against the UNION of the bucket policy and the192AP policy — so a permissive AP policy exposes the bucket even when the193bucket policy is restrictive. Multi-Region Access Points (MRAP) add a194single global ARN routed across regions, and an MRAP policy evaluated the195same way.196197Moved to [references/diagnostic-commands.md](references/diagnostic-commands.md#access-points-and-mrap-audit-steps-and-cli) — list/get AP policies per region, apply Rules 2/4 to AP policies, MRAP policy fetch.198Load that reference on demand before executing this section.199200## Procedural enumeration (large-account bulk audit)201202For accounts with hundreds or thousands of buckets, the audit must203enumerate safely before classifying. Use this procedure:204205Moved to [references/diagnostic-commands.md](references/diagnostic-commands.md#procedural-enumeration-large-account-bulk-audit) — paginated bucket listing, account BPA capture, parallel 5-input capture, per-region AP enumeration.206Load that reference on demand before executing this section.207208## Multi-statement and malformed input handling209210Moved to [references/advanced-patterns.md](references/advanced-patterns.md#multi-statement-and-malformed-input-handling) — statement iteration, Deny-condition pitfalls, NotAction/NotPrincipal, cross-policy union, malformed JSON, object ACLs.211Load that reference on demand before executing this section.212213## Condition strength matrix (summary)214215When evaluating a `Principal: "*"` Allow with a `Condition`, classify the216condition to choose between Rule 2 (PUBLIC) and Rule 4 (AMBIGUOUS). The217full table — including less-common keys (`aws:CalledViaFirst`,218`aws:MultiFactorAuthAge`, `s3:ExistingObjectTag`, `kms:ViaService`,219`aws:PrincipalOrgID`, `aws:PrincipalArn`, VPC-endpoint service220exceptions) and the `IfExists` semantics for each — lives in221`references/condition-strength-matrix.md`. Inline summary:222223**STRONG condition keys → AMBIGUOUS (Rule 4):**224- `aws:sourceVpce` / `aws:SourceVpce` (VPC Endpoint ID, `StringEquals`) —225 request must come through the named endpoint; not forgeable by the226 caller.227- `aws:sourceVpc` / `aws:SourceVpc` (VPC ID, `StringEquals`) — request228 must originate in the named VPC.229- `aws:SourceAccount` / `aws:SourceOrgID` / `aws:PrincipalOrgID` with230 `StringEquals` — restricts to a specific AWS account or Organizations231 org.232- `aws:sourceIp` (`aws:SourceIp`, `IpAddress`) restricted to a true233 private CIDR (RFC1918: `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`)234 or a documented corporate range — see §"CIDR nuance table".235236**WEAK condition keys → still PUBLIC (Rule 2):**237- `aws:Referer` (StringLike/StringEquals on Referer header) — trivially238 forgeable by any HTTP client; provides NO real access control.239- `aws:UserAgent` — same; forgeable client-side.240- `aws:sourceIp` with `0.0.0.0/0` (or omitted — equivalent to /0) —241 covers the entire internet; treat as no restriction.242- `aws:EpochTime` / `s3:authType` used alone — narrow the channel but243 not the principal.244- Any condition key wrapped in `IfExists` — weakens the assertion; treat245 per the underlying key but flag the `IfExists` semantics (see reference).246247### CIDR nuance table for `aws:sourceIp`248249Moved to [references/condition-strength-matrix.md](references/condition-strength-matrix.md#cidr-nuance-table-for-awssourceip-moved-from-skillmd) — verdict per CIDR incl. /0, RFC1918, CGNAT, TEST-NET, split-halves bypass.250Load that reference on demand before executing this section.251252## Website-hosting check253254Moved to [references/advanced-patterns.md](references/advanced-patterns.md#website-hosting-check) — website+BPA=SAFE(broken), website+public ACL/policy=PUBLIC amplification.255Load that reference on demand before executing this section.256257## Output format (per bucket) — MANDATORY literal labels258259When invoked with bucket configuration input, your ENTIRE response MUST be260the per-bucket block below (one block per bucket). The four labels are261**case-sensitive all-caps keywords** — write them EXACTLY as shown. Do NOT262substitute `Verdict`, `Reason`, `**VERDICT**`, `### Verdict`, or any263markdown variant. Do NOT write a preamble ("Based on the configuration…"),264an "Audit Findings" heading, or a trailing "Detailed Analysis" section.265Start with `BUCKET:` and stop after the `REMEDIATION:` line. A short266clarifying paragraph MAY follow the block if needed, but the block itself267MUST be the first thing in the response and MUST contain all four labels.268269```text270BUCKET: <name>271VERDICT: PUBLIC | SAFE | AMBIGUOUS272REASON: <1-2 sentences citing the specific config — include which rule number fired and the severity for PUBLIC>273REMEDIATION: <specific action, or "None required" if safe>274```275276**Worked example (copy the shape exactly):**277278```text279BUCKET: logs-archive-2024280VERDICT: PUBLIC281REASON: Rule 3 (legacy ACL grant) — AllUsers READ grant; HIGH severity (public read of log archive data).282REMEDIATION: Enable BPA (all 4 settings), remove the AllUsers ACL grant (set ACL to private).283```284285For a multi-bucket audit, emit one block per bucket, separated by a blank286line, then an optional summary table. Each block MUST contain the four287mandatory labels (`BUCKET`, `VERDICT`, `REASON`, `REMEDIATION`) — even if288REMEDIATION is "None required".289290## NEVER (anti-patterns)291292- NEVER classify a bucket as PUBLIC when BPA is fully enabled at the293 bucket level (all 4 settings True). Bucket-level BPA is authoritative294 for that bucket regardless of account-level BPA state — even a295 `Principal: "*"` policy is restricted to in-account principals. A296 false-positive PUBLIC on a BPA-protected bucket causes unnecessary297 ticket churn and erodes trust in the auditor.298299- NEVER classify a bucket as SAFE when BPA is off and a policy grants300 `s3:GetObject` (or any read/write action in the §"Rule 2" list) to301 `Principal: "*"` with no restrictive condition. This is the most302 common S3 data-leak pattern.303304- NEVER assume a `private` ACL means the bucket is safe when BPA is305 off. The ACL and the bucket policy are independent — a public policy306 overrides a private ACL because AWS unions the two. Check BOTH.307308- NEVER classify a `Principal: "*"` Allow with a strong restrictive309 condition (`aws:sourceVpce`, `aws:sourceVpc`, `aws:SourceAccount`)310 as PUBLIC. The condition narrows access to a known network or311 account — the correct verdict is AMBIGUOUS. PUBLIC means anyone on312 the internet.313314- NEVER treat a `Principal: "*"` Allow with a WEAK condition315 (`aws:Referer`, `aws:UserAgent`) as AMBIGUOUS. These keys are316 forgeable client-side and provide no real restriction — classify as317 PUBLIC. This is the inverse mistake of the previous rule.318319- NEVER recommend enabling only some BPA settings. Each setting blocks320 a different vector: `BlockPublicAcls` blocks new public ACLs but not321 policies; `BlockPublicPolicy` blocks new public policies but ignores322 legacy ACLs; `IgnorePublicAcls` neutralizes existing ACLs;323 `RestrictPublicBuckets` restricts the blast radius of public policies324 already attached. Half-enabled BPA is a false sense of security.325326- NEVER ignore `AuthenticatedUsers`327 (`http://acs.amazonaws.com/groups/global/AuthenticatedUsers`). Any328 AWS account holder can read/write — anyone can create a free-tier329 account. Treat identically to `AllUsers` for severity purposes.330331- NEVER ignore the `Principal: "*"` in a `NotAction` statement. An332 Allow with `Principal: "*"`, `NotAction: "s3:Delete*"`, and no333 condition grants every action EXCEPT Delete to the world. Easy to334 miss in manual review — the skill must flag it as PUBLIC.335336- NEVER treat static website hosting as automatically public. The337 feature does not grant access; it requires an ACL or policy to do338 so. Classify by the underlying ACL/policy, then note whether339 website hosting amplifies the exposure.340341- NEVER recommend deleting the bucket policy as the first remediation342 step without first capturing the policy content (e.g., `aws s3api343 get-bucket-policy --output json > backup.json`). Some policies are344 load-bearing for application access; a destructive remediation345 must be reversible.346347- NEVER trust a `Deny` with `Principal: "*"` as a positive signal of348 hardening without verifying the Deny's `Condition`. A Deny with349 `aws:SecureTransport: false` enforces TLS but says nothing about350 public exposure. A Deny with `aws:MultiFactorAuthPresent=false` does351 not restrict the principal set. A Deny with no condition DOES block352 all access — read the full statement.353354- NEVER classify a bucket as SAFE when it has a permissive Access Point355 or Multi-Region Access Point policy, even if the bucket policy is356 restrictive. Requests addressed through the AP ARN bypass the bucket357 policy for that surface. Always enumerate APs (`list-access-points`)358 and audit their policies.359360- NEVER recommend enabling only one BPA setting. A common pitfall is361 enabling `BlockPublicAcls` alone and concluding the bucket is safe —362 `BlockPublicPolicy` may still be False, leaving an existing public363 policy fully active. Verify all 4 settings are True at the chosen364 scope before declaring protection.365366- NEVER treat a partial-BPA bucket (e.g., 3 of 4 settings True) as367 fully BPA-protected. Per the §"Account-level vs bucket-level BPA368 interaction" truth table, each setting is independent; the missing369 setting leaves its specific vector open. Fall through to the370 policy/ACL rules and flag the partial-BPA gap explicitly.371372- NEVER infer account-level BPA state from a bucket-level reading (or373 vice versa). The two scopes are NOT inherited. If the input only374 provides one scope, ASSUME the other is OFF (worst case) and flag375 the assumption — silently inferring protection is the canonical376 cause of false-SAFE classifications.377378- NEVER rely on `aws:sourceIp` with `0.0.0.0/0` (or a paired379 `0.0.0.0/1` + `128.0.0.0/1`) as a real restriction. The condition380 matches every IPv4 address; classify as PUBLIC (Rule 2). Same for381 any IP-list condition containing even a single `/0` entry — AWS382 ORs the list, so one open entry widens access.383384- NEVER fire Rule 3 (legacy ACL) when Object Ownership is385 `BucketOwnerEnforced`. ACLs are disabled at the API layer on these386 buckets — any ACL grant in `get-bucket-acl` output is a cosmetic387 leftover. Note the stale grant but do not classify as PUBLIC via ACL.388389- NEVER treat the bucket policy in isolation when Access Points are390 in scope. The effective permission for AP-addressed requests is the391 union of bucket policy + AP policy; a restrictive bucket policy392 does NOT restrict AP-addressed requests.393394- NEVER deviate from the four-line output block. Substituting395 `Verdict` / `**VERDICT**` / `### Verdict:` / `Conclusion:` (or any396 prose variant) for the literal `VERDICT:` label silently breaks397 downstream parsers and assertion-based evals. Same for `REASON:`398 and `REMEDIATION:`. The labels are uppercase, end with a colon,399 and appear on their own line. Even when REMEDIATION is "None400 required", the label MUST be present.401402- NEVER preface the verdict block with a preamble like "Based on the403 configuration…" or an "### Audit Findings" heading. The first404 non-blank line of the response MUST be `BUCKET: <name>`. A short405 clarifying section may FOLLOW the block, but the block itself must406 lead the response.407408## Pre-flight safety checks (run before any remediation CLI)409410- Confirm the bucket exists in the target account/region:411 `aws s3api head-bucket --bucket <name>` — fail closed (skip412 remediation) if it returns an error.413- Capture current state for rollback:414 `aws s3api get-bucket-policy --bucket <name> --output json > /tmp/<name>-policy-backup-$(date +%s).json`415 and416 `aws s3api get-bucket-acl --bucket <name> --output json > /tmp/<name>-acl-backup-$(date +%s).json`417 BEFORE any modification.418- Prefer additive changes (enable BPA) over destructive changes (delete419 policy). Enabling BPA is reversible by setting all 4 back to False;420 deleting a policy may lose application access intent.421- For write-open buckets (PUBLIC with `s3:PutObject`/`s3:DeleteObject`),422 treat as incident-response — enable BPA IMMEDIATELY before capturing423 full forensic state, because every second of write-open exposure is424 data destruction risk. Capture state AFTER containing.425426## Remediation guidance427428Moved to [references/bpa-settings-and-cli-commands.md](references/bpa-settings-and-cli-commands.md#remediation-guidance-per-verdict-moved-from-skillmd) — action plans for PUBLIC read/write/ACL, AMBIGUOUS, SAFE postures.429Load that reference on demand before executing this section.430431## Remediation for Access-Point-exposed buckets432433Moved to [references/bpa-settings-and-cli-commands.md](references/bpa-settings-and-cli-commands.md#remediation-for-access-point-exposed-buckets-moved-from-skillmd) — AP policy tightening, account BPA, CloudFront OAC fronting, MRAP propagation.434Load that reference on demand before executing this section.435436## Remediation for partial-BPA buckets437438Moved to [references/bpa-settings-and-cli-commands.md](references/bpa-settings-and-cli-commands.md#remediation-for-partial-bpa-buckets-moved-from-skillmd) — same-scope completion, IgnorePublicAcls inertness note, BucketOwnerEnforced fix.439Load that reference on demand before executing this section.440441## Adjacent postures worth flagging (not part of the verdict)442443Moved to [references/advanced-patterns.md](references/advanced-patterns.md#adjacent-postures-worth-flagging-not-part-of-the-verdict) — KMS key-policy backdoor, Object Lambda APs, VPC endpoint policies.444Load that reference on demand before executing this section.445446## Recent AWS features (2024-2026)447448Moved to [references/advanced-patterns.md](references/advanced-patterns.md#recent-aws-features-2024-2026) — directory buckets, Access Grants, S3 Tables, Express One Zone, versioning defaults.449Load that reference on demand before executing this section.450451## References452453- `references/bpa-settings-and-cli-commands.md` — full BPA enablement454 CLI commands (with pre-flight backup), account-level vs bucket-level455 detail, CloudFront OAC migration snippet, copy-pasteable remediation.456- `references/condition-strength-matrix.md` — exhaustive table of457 strong vs weak condition keys (including rare keys:458 `aws:CalledViaFirst`, `aws:MultiFactorAuthAge`, `s3:authType`,459 `s3:ExistingObjectTag`, `kms:ViaService`), `IfExists` semantics, and460 worked examples for each.461462## Section taxonomy (CloudOps auditor pattern)463464Moved to [references/advanced-patterns.md](references/advanced-patterns.md#section-taxonomy-cloudops-auditor-pattern) — the 17-section canonical order this skill follows.465Load that reference on demand before executing this section.466467468## References (load on demand)469470- [references/bpa-settings-and-cli-commands.md](references/bpa-settings-and-cli-commands.md) — full BPA enablement/verification CLI, account vs bucket scope, ACL/policy removal, CloudFront OAC, per-verdict remediation guidance.471- [references/condition-strength-matrix.md](references/condition-strength-matrix.md) — exhaustive strong/weak condition-key table, IfExists semantics, CIDR nuance table, worked examples.472- [references/diagnostic-commands.md](references/diagnostic-commands.md) — bulk-audit enumeration commands and Access-Point/MRAP audit CLI.473- [references/advanced-patterns.md](references/advanced-patterns.md) — BPA scope implications, Object Ownership, edge-case handling, website check, adjacent postures, recent AWS features.474## Domain475476AWS CloudOps / S3 Security & Compliance.477478## AWS documentation479480- **Amazon S3 User Guide** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html481- **S3 Security Best Practices** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/security-best-practices.html482- **S3 API Reference** — https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html483- **S3 CLI Reference (s3api)** — https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html484- **S3 CLI Reference (high-level s3)** — https://docs.aws.amazon.com/cli/latest/reference/s3/index.html485- **Block Public Access** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html486- **S3 Access Grants** — https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-grants.html