GCP - Enumeração de Armazenamento Não Autenticada

Reading time: 3 minutes

tip

Aprenda e pratique Hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Aprenda e pratique Hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Aprenda e pratique Hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Support HackTricks

Armazenamento

Para mais informações sobre Armazenamento, consulte:

GCP - Storage Enum

Força Bruta de Bucket Público

O formato de uma URL para acessar um bucket é https://storage.googleapis.com/<bucket-name>.

As seguintes ferramentas podem ser usadas para gerar variações do nome fornecido e procurar por buckets mal configurados com esses nomes:

Além das ferramentas mencionadas em:

GCP - Unauthenticated Enum & Access

Se você descobrir que pode acessar um bucket, pode ser capaz de escalar ainda mais, consulte:

GCP - Public Buckets Privilege Escalation

Buscar Buckets Abertos na Conta Atual

Com o seguinte script coletado daqui, você pode encontrar todos os buckets abertos:

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

tip

Aprenda e pratique Hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Aprenda e pratique Hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Aprenda e pratique Hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Support HackTricks