GCP - Workflows Privesc
Last updated
Last updated
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Basic Information:
GCP - Workflows Enumworkflows.workflows.create
, iam.serviceAccounts.ActAs
, workflows.executions.create
, (workflows.workflows.get
, workflows.operations.get
)Afaik it's not possible to get a shell with access to the metadata endpoint containing the SA credentials of the SA attacked to a Workflow. However, it's possible to abuse the permissions of the SA by adding the actions to perform inside the Workflow.
It's possible to find the documentation of the connectors. For example, this is the page of the Secretmanager connector. In the side bar it's possible to find several other connectors.
And here you can find an example of a connector that prints a secret:
Update from the CLI:
If you get an error like ERROR: (gcloud.workflows.deploy) FAILED_PRECONDITION: Workflows service agent does not exist
, just wait a minute and try again.
If you don't have web access it's possible to trigger and see the execution of a Workflow with:
You can also check the output of previous executions to look for sensitive information
Note that even if you get an error like PERMISSION_DENIED: Permission 'workflows.operations.get' denied on...
because you don't have that permission, the workflow has been generated.
According to the docs it's possible to use workflow steps that will send an HTTP request with the OAuth or OIDC token. However, just like in the case of Cloud Scheduler, the HTTP request with the Oauth token must be to the host .googleapis.com
.
Therefore, it's possible to leak the OIDC token by indicating a HTTP endpoint controlled by the user but to leak the OAuth token you would need a bypass for that protection. However, you are still able to contact any GCP api to perform actions on behalf the SA using either connectors or HTTP requests with the OAuth token.
workflows.workflows.update
...With this permission instead of workflows.workflows.create
it's possible to update an already existing workflow and perform the same attacks.
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)