You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Google Cloud Dataproc roles like roles/dataproc.editor and roles/dataproc.admin grant significant permissions over Dataproc resources. If these roles are assigned to a compromised user or service account, they can be abused to escalate privileges by leaking sensitive metadata tokens or accessing other GCP resources.
5
+
## Dataproc
6
6
7
-
## Key Permissions in Dataproc Roles
7
+
{{#ref}}
8
+
../gcp-services/gcp-dataproc-enum.md
9
+
{{#endref}}
8
10
9
-
roles/dataproc.editor - Modify Dataproc jobs. Submit PySpark, Spark, Hadoop, and other job types to a cluster. Access job logs and configurations. Interact with associated GCP services like Cloud Storage and BigQuery.
roles/dataproc.admin - Full control over Dataproc clusters, including creating, deleting, and managing clusters.
12
-
13
-
These permissions make both roles highly sensitive and dangerous if misused.
14
-
15
-
## dataproc.jobs.create & dataproc.clusters.use
16
-
17
-
The following method - projects.regions.jobs.submit enables a SA to create a dataproc job, which can be abused as shown in the example below. it must be noted that in order to exploit these permissions SA should also have the necessary privileges to move the malicious script to the storage bucket (storage.objects.create).
18
-
19
-
the following permissions were assigned to the SA for the PoC (dataproc.clusters.get, dataproc.clusters.use, dataproc.jobs.create, dataproc.jobs.get, dataproc.jobs.list, storage.objects.create, storage.objects.get, storage.objects.list)
20
-
21
-
22
-
## Privilege Escalation via Metadata Token Leaking
13
+
I was unable to get a reverse shell using this method, however it is possible to leak SA token from the metadata endpoint using the method described below.
23
14
15
+
#### Steps to exploit
24
16
17
+
- Place the job script on the GCP Bucket
25
18
26
19
- Submit a job to a Dataproc cluster.
27
20
28
21
- Use the job to access the metadata server.
29
22
30
23
- Leak the service account token used by the cluster.
31
24
32
-
### Example Script for token leaking
33
-
34
-
The following script demonstrates how an attacker can submit a job to a Dataproc cluster to leak the metadata token:
@@ -36,12 +38,10 @@ gcloud dataproc jobs list --region=<region>
36
38
gcloud dataproc jobs describe <job-id> --region=<region>
37
39
```
38
40
39
-
### Post Exploitation
40
-
41
-
Enumerating Dataproc clusters can expose sensitive data, such as tokens, configuration scripts, or job output logs, which can be leveraged for further exploitation. Misconfigured roles or excessive permissions granted to the service account can allow:
42
-
43
-
Access to sensitive APIs (e.g., BigQuery, Cloud Storage).
0 commit comments