IAM
Abusable GCP IAM permissions that can lead to compromise or privilege escalation
*.*.setIamPolicy
Because IAM policies get inherited from the Organization downward, the following permissions at their respective levels enable privilege escalation:
Organization:
resourcemanager.organizations.setIamPolicyFolder:
resourcemanager.folders.setIamPolicyProject:
resourcemanager.projects.setIamPolicyService Account:
iam.serviceAccounts.setIamPolicyResources:
<resource>.setIamPolicy
Below is an example of granting yourself access to create a credential on the target Service Account enabling you to then impersonate that SA.
gcloud iam service-accounts add-iam-policy-binding <TARGET_SA>@<PROJECT>.iam.gserviceaccount.com \
--member="serviceAccount:<ATTACKER_SA>@<PROJECT>.iam.gserviceaccount.com" \
--role="roles/iam.serviceAccountTokenCreator"
gcloud config set auth/impersonate_service_account <TARGET_SA>@<PROJECT>.iam.gserviceaccount.comiam.roles.update
With this permission, an attacker can add any permission to an existing custom role without needing to create a new role or touch IAM bindings.
iam.serviceAccountKeys.create
With this permission on a target service account, an attacker can create a persistent JSON key for that SA and authenticate as it indefinitely.
iam.serviceAccounts.getAccessToken
With this permission granted on a target service account, an attacker can generate a short-lived OAuth access token and impersonate that SA — no private key required.
iam.serviceAccounts.implicitDelegation
With this permission on a middle SA, an attacker can use it as a delegation hop — passing through it to reach a target SA that has granted the middle SA
getAccessToken. The entire chain is resolved in a single call; you never materialize credentials for the middle SA. This differs from AWS IAM role chaining, where you must first assume Role A (receiving STS credentials) before using those credentials to assume Role B.
Last updated