# GCP - Storage Unauthenticated Enum

{{#include ../../../../banners/hacktricks-training.md}}

## Storage

For more information about Storage check:

{{#ref}}
../../gcp-services/gcp-storage-enum.md
{{#endref}}

### 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:

- [https://github.com/RhinoSecurityLabs/GCPBucketBrute](https://github.com/RhinoSecurityLabs/GCPBucketBrute)

**Also the tools** mentioned in:

{{#ref}}
../
{{#endref}}

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

{{#ref}}
gcp-public-buckets-privilege-escalation.md
{{#endref}}

### Search Open Buckets in Current Account

With the following script [gathered from here](https://gitlab.com/gitlab-com/gl-security/security-operations/gl-redteam/gcp_misc/-/blob/master/find_open_buckets.sh) you can find all the open buckets:

```bash
#!/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
```

{{#include ../../../../banners/hacktricks-training.md}}



