GCP - Federation Abuse
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
OIDC - Github Actions Abuse
GCP
In order to give access to the Github Actions from a Github repo to a GCP service account the following steps are needed:
Create the Service Account to access from github actions with the desired permissions:
Generate a new workload identity pool:
Generate a new workload identity pool OIDC provider that trusts github actions (by org/repo name in this scenario):
Finally, allow the principal from the provider to use a service principal:
Note how in the previous member we are specifying the org-name/repo-name
as conditions to be able to access the service account (other params that makes it more restrictive like the branch could also be used).
However it's also possible to allow all github to access the service account creating a provider such the following using a wildcard:
In this case anyone could access the service account from github actions, so it's important always to check how the member is defined. It should be always something like this:
attribute.{custom_attribute}
:principalSet://iam.googleapis.com/projects/{project}/locations/{location}/workloadIdentityPools/{pool}/attribute.{custom_attribute}/{value}
Github
Remember to change ${providerId}
and ${saId}
for their respective values:
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Last updated