GCP - Cloud Build Unauthenticated Enum
{{#include ../../../banners/hacktricks-training.md}}
Cloud Build
For more information about Cloud Build check:
{{#ref}}
../gcp-services/gcp-cloud-build-enum.md
{{#endref}}
cloudbuild.yml
If you compromise write access over a repository containing a file named cloudbuild.yml, you could backdoor this file, which specifies the commands that are going to be executed inside a Cloud Build and exfiltrate the secrets, compromise what is done and also compromise the Cloud Build service account.
For some related information you could check the page about how to attack Github Actions (similar to this):
{{#ref}}
../../../pentesting-ci-cd/github-security/abusing-github-actions/
{{#endref}}
PR Approvals
When the trigger is PR because anyone can perform PRs to public repositories it would be very dangerous to just allow the execution of the trigger with any PR. Therefore, by default, the execution will only be automatic for owners and collaborators, and in order to execute the trigger with other users PRs an owner or collaborator must comment /gcbrun.
Moreover, it's easy to see if some cloudbuild execution needs to be performed when you send a PR because it appears in Github:
{{#include ../../../banners/hacktricks-training.md}}