GCP - Storage Unauthenticated Enum

Support HackTricks

Storage

For more information about Storage check:

GCP - Storage Enum

Public Bucket Brute Force

The format of an URL to access a bucket is https://storage.googleapis.com/<bucket-name>.

The following tools can be used to generate variations of the name given and search for miss-configured buckets with that names:

Also the tools mentioned in:

GCP - Unauthenticated Enum & Access

If you find that you can access a bucket you might be able to escalate even further, check:

GCP - Public Buckets Privilege Escalation

Search Open Buckets in Current Account

With the following script gathered from here you can find all the open buckets:

#!/bin/bash

############################
# Run this tool to find buckets that are open to the public anywhere
# in your GCP organization.
#
# Enjoy!
############################

for proj in $(gcloud projects list --format="get(projectId)"); do
    echo "[*] scraping project $proj"
    for bucket in $(gsutil ls -p $proj); do
        echo "    $bucket"
        ACL="$(gsutil iam get $bucket)"

        all_users="$(echo $ACL | grep allUsers)"
        all_auth="$(echo $ACL | grep allAuthenticatedUsers)"

        if [ -z "$all_users" ]
        then
              :
        else
              echo "[!] Open to all users: $bucket"
        fi

        if [ -z "$all_auth" ]
        then
              :
        else
              echo "[!] Open to all authenticated users: $bucket"
        fi
    done
done
Support HackTricks

Last updated