stratus-red-team icon indicating copy to clipboard operation
stratus-red-team copied to clipboard

GCP: Retrieval of project/organization IAM policy

Open christophetd opened this issue 2 years ago • 2 comments

Sources:

  • https://about.gitlab.com/blog/2020/02/12/plundering-gcp-escalating-privileges-in-google-cloud-platform/
  • https://book.hacktricks.xyz/cloud-security/gcp-security#enumeration
gcloud projects get-iam-policy sandbox
gcloud organizations get-iam-policy xxxx

Sample log:

{
  "resource": {
    "labels": {
      "project_id": "sandbox-project"
    },
    "type": "project"
  },
  "severity": "INFO",
  "receiveTimestamp": "2022-07-28T08:35:45.933806396Z",
  "insertId": "-fiy70udkd6g",
  "logName": "projects/sandbox-project/logs/cloudaudit.googleapis.com%2Fdata_access",
  "timestamp": "2022-07-28T08:35:45.549383Z",
  "protoPayload": {
    "authorizationInfo": [
      {
        "granted": true,
        "resource": "projects/sandbox-project",
        "resourceAttributes": {
          "type": "cloudresourcemanager.googleapis.com/Project",
          "name": "projects/sandbox-project",
          "service": "cloudresourcemanager.googleapis.com"
        },
        "permission": "resourcemanager.projects.getIamPolicy"
      }
    ],
    "request": {
      "resource": "sandbox-project",
      "@type": "type.googleapis.com/google.iam.v1.GetIamPolicyRequest",
      "options": {
        "requestedPolicyVersion": 3
      }
    },
    "requestMetadata": {},
    "resourceName": "projects/sandbox-project",
    "authenticationInfo": {
      "principalSubject": "user:[email protected]",
      "principalEmail": "[email protected]"
    },
    "@type": "type.googleapis.com/google.cloud.audit.AuditLog",
    "serviceName": "cloudresourcemanager.googleapis.com"
  }
}

christophetd avatar Jul 28 '22 08:07 christophetd

we should include folders in this, too, along with modification

jonpulsifer avatar Aug 15 '22 19:08 jonpulsifer

Thanks for your input @jonpulsifer, can you clarify what you mean?

christophetd avatar Aug 17 '22 12:08 christophetd

Sounds way too common to be a TTP, on second thoughts

christophetd avatar Apr 26 '23 07:04 christophetd