GCP - Storage Post Exploitation

支持 HackTricks

云存储

有关云存储的更多信息,请查看此页面:

GCP - Storage Enum

授予公共访问权限

可以向外部用户(已登录 GCP 或未登录)授予对存储桶内容的访问权限。但是,默认情况下,存储桶将禁用公开暴露存储桶的选项:

# Disable public prevention
gcloud storage buckets update gs://BUCKET_NAME --no-public-access-prevention

# Make all objects in a bucket public
gcloud storage buckets add-iam-policy-binding gs://BUCKET_NAME --member=allUsers --role=roles/storage.objectViewer
## I don't think you can make specific objects public just with IAM

# Make a bucket or object public (via ACL)
gcloud storage buckets update gs://BUCKET_NAME --add-acl-grant=entity=AllUsers,role=READER
gcloud storage objects update gs://BUCKET_NAME/OBJECT_NAME --add-acl-grant=entity=AllUsers,role=READER

如果您尝试为已禁用ACL的存储桶提供ACL,则会遇到此错误:ERROR: HTTPError 400: Cannot use ACL API to update bucket policy when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access

要通过浏览器访问公开的存储桶,请访问以下网址:https://<bucket_name>.storage.googleapis.com/https://<bucket_name>.storage.googleapis.com/<object_name>

Last updated