#12872·prowler

`s3_bucket_public_access` reports a public bucket as PASS when `GetBucketAcl` or `GetBucketPolicy` is denied

Author: Panchal-SahilCreated Sep 22, 2026Updated Sep 22, 2026
Labelsbugstatus/needs-triage

Issue search

  • I have searched the existing issues and this bug has not been reported yet

Which component is affected?

Prowler CLI/SDK

Cloud Provider (if applicable)

AWS

Steps to Reproduce

  1. Create a bucket whose ACL grants AllUsers READ (or whose policy allows Principal: "*"), with no public access block on the bucket or the account.
  2. Scan with an identity that can list buckets but gets AccessDenied on s3:GetBucketAcl (or s3:GetBucketPolicy) for that bucket. For example, a bucket policy or SCP with an explicit Deny on that action.
  3. Run prowler aws -c s3_bucket_public_access.

I reproduced this with moto by raising AccessDenied for the one operation from BaseClient._make_api_call, the same way the s3_bucket_cross_region_replication tests deny GetBucketReplication. I have not reproduced it against a real AWS account.

python
from unittest import mock
from boto3 import client
from botocore.client import BaseClient
from botocore.exceptions import ClientError
from moto import mock_aws
from tests.providers.aws.utils import AWS_REGION_US_EAST_1, set_mocked_aws_provider

_orig = BaseClient._make_api_call

def _deny(self, operation_name, kwarg):
    if operation_name == "GetBucketAcl":
        raise ClientError({"Error": {"Code": "AccessDenied", "Message": "Access Denied"}}, operation_name)
    return _orig(self, operation_name, kwarg)

@mock_aws
def test_repro():
    s3 = client("s3", region_name=AWS_REGION_US_EAST_1)
    s3.create_bucket(Bucket="public-acl")
    s3.put_bucket_acl(Bucket="public-acl", ACL="public-read")
    from prowler.providers.aws.services.s3.s3_service import S3, S3Control
    provider = set_mocked_aws_provider([AWS_REGION_US_EAST_1])
    mod = "prowler.providers.aws.services.s3.s3_bucket_public_access.s3_bucket_public_access"
    with mock.patch("botocore.client.BaseClient._make_api_call", new=_deny), \
         mock.patch("prowler.providers.common.provider.Provider.get_global_provider", return_value=provider), \
         mock.patch(f"{mod}.s3_client", new=S3(provider)), \
         mock.patch(f"{mod}.s3control_client", new=S3Control(provider)):
        from prowler.providers.aws.services.s3.s3_bucket_public_access.s3_bucket_public_access import s3_bucket_public_access
        result = s3_bucket_public_access().execute()
    print(result[0].status, result[0].status_extended)
    # PASS S3 Bucket public-acl is not public.

Expected behavior

A per-bucket MANUAL finding that says the ACL (or policy) could not be read and names the missing permission. s3_bucket_object_versioning does this for a bucket whose versioning_retrieved is False (#12645).

Permission and Data-Availability Errors Are Not Findings in docs/developer-guide/checks.mdx asks the service layer to expose a failed read "in a way that cannot be confused with a legitimate empty result". At HEAD, acl_grantees holds [] after a denied read and after a read that found no grants.

Actual Result with Screenshots or Logs

PASS with S3 Bucket public-acl is not public. The only trace is a logger.error line, which the default --log-level hides. With that bucket as the only finding, the scan exits 0 instead of 3.

Five checks read these two fields. With the call allowed, each check reports FAIL on these buckets (the last one reports PASS):

Denied call Check Bucket state Result with the call denied
GetBucketAcl s3_bucket_public_access AllUsers READ grant PASS "is not public."
GetBucketAcl s3_bucket_public_list_acl AllUsers READ grant PASS "is not publicly listable."
GetBucketAcl s3_bucket_public_write_acl AllUsers WRITE grant PASS "is not publicly writable."
GetBucketAcl cloudtrail_logs_s3_bucket_is_not_publicly_accessible trail bucket with an AllUsers grant PASS "is not publicly accessible."
GetBucketPolicy s3_bucket_public_access policy allows Principal: "*" PASS "is not public."
GetBucketPolicy s3_bucket_secure_transport_policy policy denies aws:SecureTransport: false FAIL "does not have a bucket policy, thus it allows HTTP requests."

Cause, from reading s3_service.py:

  • _get_bucket_acl logs a non-NoSuchBucket ClientError and leaves acl_grantees at its [] default. The checks can't tell that apart from a bucket with no grants.
  • _get_bucket_policy marks the failure by leaving policy=None (#6908), but s3_bucket_public_access skips the policy test when policy is None and keeps its default PASS. s3_bucket_secure_transport_policy treats None like "no policy".

If the scan identity also can't read the public access block (a broad s3:GetBucket* deny), the three S3 ACL checks drop the bucket instead. test_bucket_can_not_retrieve_public_access_block pins that behavior, so I left it alone. The CloudTrail check skips the public access block and reports PASS in that case too.

How did you install Prowler?

Cloning the repository from github.com (git clone)

Environment Resource

Local workstation (moto)

OS used

Fedora Linux 44

Prowler version

5.43.0 (ea36f12)

Python version

3.12.13

Pip version

25.0.1 (dependencies installed with uv sync)

Context

I have a fix with tests ready that follows the versioning_retrieved pattern, and I'm opening the PR now. Could this issue be assigned to me?