Skip to content

LearnCloud

Public bucket checks: S3, Azure Blob, GCS

Brief

A bucket name and no credentials is three questions: does the name exist, does it answer anonymous requests, and whose is it. Each cloud answers the first two with one unsigned request, and the third only through public signals and the client's written word.

Track
Cloud
Stage
Recon
Reviewed
On this page
  1. Check first
  2. AWS
  3. Azure
  4. GCP
  5. The defender sees
  6. Done when
  7. Not covered
  8. Tools
  9. Where this page fits
  10. Reviewed

All commands

Cloud volume Chapter 17 of Cloud Penetration Testing, "Storage exposure: buckets, SAS links, snapshots, function URLs, registries", goes further than this page. The book is in production.

Situation
A bucket, storage account or container name found in a page, a DNS record, a repository or an app binary during recon on a client named in the scope letter, and no credentials for it. Every request on this page is unsigned, nothing is written, and no object body is downloaded: the proof is one listing of at most three names or the headers of one object. A name the client does not confirm as theirs gets a note in the table, not a request.
Goal
An exposure table: for each name, the cloud, whether it exists, whether anonymous listing or reads work, the owner evidence, and the one proof request with its timestamp.
Outputs
The AWS section was captured on 8 Nov 2026 (UTC) against two private buckets in the Atarus lab AWS Organization, from the Atarus Bench edition 2026.11-cloud-0.3, AWS CLI 2.39.3 and curl 8.14.1, with the bucket names replaced by stable placeholders; every request was unsigned. The steps say which AWS blocks stay representative. The Azure and GCP sections stay representative on placeholder names until the lab Azure subscription and GCP project are captured.

Check first

  • Which cloud the name belongs to: <bucket>.s3.amazonaws.com, <account>.blob.core.windows.net, or storage.googleapis.com/<bucket>.
  • Where the name came from: a page, a CNAME, a build file, an app binary. That is the first owner signal.
  • Whether the letter covers the account or project the name sits in.
  • The rule: one timestamped listing of at most three names, or the headers of one object, nothing more.

Steps

AWS

Does the bucket exist, and does it answer anonymous requests?

for b in example-exports example-assets no-such-bucket-7f3a; do
  printf '%s ' "$b"
  curl -s -o /dev/null -w '%{http_code} %header{x-amz-bucket-region}\n' "https://$b.s3.amazonaws.com/"
done

Expected output

example-exports 403 us-east-1   # <- the bucket exists and listing is denied; single objects may still be public
example-assets 403 us-east-1
no-such-bucket-7f3a 404 

A request to a bucket that exists, signed or not, returns x-amz-bucket-region whatever the permissions: 403 when listing is denied, 200 when anyone can list it. A free name answers 404 with no region. Both lab buckets exist and refuse an anonymous listing; the lab never opens one, so a 200 is described here rather than shown. The client's DNS is the next signal, and the lab has no name pointing at S3, so this line and its answer are representative:

dig +short assets.example.com CNAME

Expected output

example-assets.s3.amazonaws.com.

Ownership is a separate question: the strongest public signal is the client's own DNS pointing at the bucket, then the name in their pages and apps and a region matching their other hosts. The owner id in a listing names an account, not a company, and we never test account ids against x-amz-expected-bucket-owner.

Negative result. 404 for every name, or 403 on a name nobody claims. On a name the client claims, 403 is clean for listing, and the next step checks single objects.

Fix. Block public access for the whole account with aws s3control put-public-access-block --account-id 111122223333 --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true, and inventory every bucket a DNS name or page points at.

What is the least-impact proof on S3?

aws s3 ls s3://example-exports --no-sign-request --region us-east-1
aws s3api head-object --bucket example-assets --key static/app.js --no-sign-request --region us-east-1 \
  --query '[ContentLength,ContentType,LastModified]' --output text

Expected output


aws: [ERROR]: An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied   # <- the listing is refused

aws: [ERROR]: An error occurred (403) when calling the HeadObject operation: Forbidden   # <- and so is the head of the one object the client's page names

Both lab buckets refuse, which is the negative result below. On a bucket that answers, the listing is cut to three lines. The lab never opens a bucket, so this block and its answer are representative, on a placeholder bucket:

aws s3 ls s3://example-public --no-sign-request --region us-east-1 | head -3
aws s3api head-object --bucket example-public --key static/app.js --no-sign-request --region us-east-1 \
  --query '[ContentLength,ContentType,LastModified]' --output text

Expected output

                           PRE backups/   # <- a prefix name is enough; nothing under it is listed or fetched
2026-03-14 08:12:41      48213 export-2026-03.csv
2025-11-02 17:45:09       1189 robots.txt
48213	application/javascript	2026-04-02T11:20:07+00:00   # <- the object is readable anonymously; its body never leaves the bucket

Three lines, and the headers of one object whose key the client's own page names. We stop there, even when a name says export. Where listing is denied and no page names a key, the row records 403.

Negative result. An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied, and a 403 on the head.

Fix. On the bucket, the same four settings, aws s3api put-bucket-ownership-controls --bucket example-assets --ownership-controls 'Rules=[{ObjectOwnership=BucketOwnerEnforced}]' so ACLs stop mattering, CloudFront with origin access control for anything public, and aws s3api put-bucket-logging --bucket example-assets --bucket-logging-status file://logging.json for server access logs.

Azure

Does the container list or serve blobs anonymously?

for c in public backups; do
  printf '%s ' "$c"
  curl -s -o /dev/null -w '%{http_code}\n' -H 'x-ms-version: 2021-08-06' \
    "https://examplestorage.blob.core.windows.net/$c?restype=container&comp=list"
done
curl -s -o /dev/null -w '%{http_code}\n' "https://examplestorage.blob.core.windows.net/backups?restype=container&comp=list"
curl -s -o /dev/null -w '%{http_code}\n' "https://examplelocked.blob.core.windows.net/backups?restype=container&comp=list"
dig +short cdn.example.com CNAME

Expected output

public 200   # <- the container's access level is Container: anyone can list it
backups 401
404   # <- no version header: the account allows anonymous access and this container is private
409   # <- the second account disallows anonymous access altogether
examplestorage.blob.core.windows.net.

Two settings decide the answer: the account's anonymous access switch and the container's level, Private, Blob or Container. With a current service version a denied request is 401. Without a version header the service falls back to an old one and the error then separates the two settings: 409 when the account disallows anonymous access, 404 when it allows it and the container is private. Account names are unique across Azure, so the client's CNAME to the account and the name in their pages are the owner signals; the storage hostname names nobody.

Negative result. 401 for every container with the version header, or 409 without it.

Fix. az storage account update -n examplestorage -g example-rg --allow-blob-public-access false, which overrides every container, and an Azure Policy assignment that audits or denies allowBlobPublicAccess.

What is the least-impact proof on Azure?

curl -s -H 'x-ms-version: 2021-08-06' \
  "https://examplestorage.blob.core.windows.net/public?restype=container&comp=list&maxresults=3" | grep -o '<Name>[^<]*</Name>'
curl -sI "https://examplestorage.blob.core.windows.net/reports/customers-2026-04.csv" | grep -iE '^(HTTP|content-length|content-type|last-modified)'

Expected output

<Name>index.html</Name>
<Name>exports/customers-2026-03.csv</Name>   # <- a name that says what the container holds; the body stays where it is
<Name>exports/customers-2026-04.csv</Name>
HTTP/1.1 200 OK
Content-Length: 48213
Content-Type: text/csv   # <- a container at the Blob level: readable by URL, not listable
Last-Modified: Tue, 14 Apr 2026 08:12:41 GMT

maxresults caps the listing at three names. The HEAD is for a container at the Blob level, which refuses listing but serves any blob whose URL the client's page names; the headers prove the read, nothing is fetched.

Negative result. An empty Blobs element or 401 on the listing, 404 on the HEAD.

Fix. --public-network-access Disabled with a private endpoint for internal consumers, --allow-shared-key-access false, and a diagnostic setting sending StorageRead to a Log Analytics workspace.

GCP

Does the bucket answer anonymous requests?

for b in example-assets example-assets-prod no-such-bucket-7f3a; do
  printf '%s ' "$b"
  curl -s "https://storage.googleapis.com/storage/v1/b/$b/iam/testPermissions?permissions=storage.objects.list&permissions=storage.objects.get" \
    | jq -c '.permissions // .error.code'
done
dig +short files.example.com CNAME

Expected output

example-assets ["storage.objects.get","storage.objects.list"]   # <- allUsers can list and read; no object has been named yet
example-assets-prod []
no-such-bucket-7f3a 404
c.storage.googleapis.com.   # <- the client's DNS points at Cloud Storage: the owner signal

testIamPermissions needs no permission of its own and returns only what the caller holds, so it reveals nothing. The bucket resource carries a projectNumber, but reading it needs storage.buckets.get, which anonymous callers rarely hold. The owner signals are the CNAME to c.storage.googleapis.com and storage.googleapis.com/<bucket> URLs in the client's pages.

Negative result. An empty permissions list for every name, or 404 for a free name.

Fix. gcloud storage buckets update gs://example-assets --public-access-prevention --uniform-bucket-level-access, then gcloud storage buckets remove-iam-policy-binding gs://example-assets --member=allUsers --role=roles/storage.objectViewer, and the organization policy constraints/storage.publicAccessPrevention so no new bucket can be opened.

What is the least-impact proof on Cloud Storage?

curl -s "https://storage.googleapis.com/storage/v1/b/example-assets/o?maxResults=3&fields=items(name,size,updated)" \
  | jq -r '.items[] | [.name, .size, .updated] | @tsv'
curl -sI "https://storage.googleapis.com/example-assets/exports/orders-2026-03.csv" | grep -iE '^(HTTP|content-type|content-length|last-modified)'

Expected output

index.html	4213	2026-02-01T10:02:11.431Z
exports/orders-2026-03.csv	48213	2026-03-14T08:12:41.002Z   # <- three names, and the proof stops here
exports/orders-2026-04.csv	50117	2026-04-14T08:12:39.771Z
HTTP/2 200
content-type: text/csv
content-length: 48213   # <- readable by anyone with the URL; the body is not fetched
last-modified: Sat, 14 Mar 2026 08:12:41 GMT

maxResults=3 caps the listing and fields trims it to names, sizes and dates. The HEAD proves a read on a bucket that refuses listing but grants storage.objects.get, with a key the client's page names.

Negative result. 401 with the anonymous caller message on the listing, and 401 or 403 on the HEAD.

Fix. gcloud storage buckets update gs://example-assets --log-bucket=gs://example-logs for usage logs, because Cloud Audit Logs do not record access to public objects, and a load balancer backend bucket for anything that must be public.

The defender sees

On S3, each request is a server access log line with the remote address, a - in the Requester, Signature Version and Authentication Type fields, and REST.GET.BUCKET or REST.HEAD.OBJECT as the operation; with CloudTrail data events on, the same requests carry userIdentity.accountId set to anonymous and no arn. On Azure, a diagnostic setting puts them in StorageBlobLogs with AuthenticationType equal to Anonymous, CallerIpAddress, Uri and an OperationName of ListBlobs or GetBlobProperties, and Defender for Storage raises "Publicly accessible storage containers successfully discovered" or "Unusual unauthenticated access to a storage container". On Cloud Storage only usage logs see us, delivered hourly with c_ip, cs_method, cs_uri, sc_status and cs_user_agent and no principal, since Cloud Audit Logs do not track access to public objects; a bucket with no log bucket has no record of the proof. Every platform needs one alert, on an anonymous read of a bucket not meant to be public. If the client cannot find our timestamped request, logging is the second finding.

Done when

Every name has a row with existence, listing and read results, owner evidence or a note that ownership is unconfirmed, and one timestamped proof request the client can find in their logs.

Not covered

Authenticated bucket review, which the AWS, Entra and GCP pages cover, name guessing at scale, and reading or copying any object body.