Detection rules › Panther
GCP Compute IAM Policy Update Detection
This rule detects updates to IAM policies for Compute Disks, Images, and Snapshots.
Rule body yaml
AnalysisType: rule
DedupPeriodMinutes: 60
DisplayName: GCP Compute IAM Policy Update Detection
Enabled: true
Filename: gcp_compute_set_iam_policy.py
RuleID: "GCP.Compute.IAM.Policy.Update"
Severity: Medium
LogTypes:
- GCP.AuditLog
Description: >
This rule detects updates to IAM policies for Compute Disks, Images, and Snapshots.
Runbook: >
Ensure that the IAM policy update was expected. Unauthorized changes can lead to security risks.
Reference: https://cloud.google.com/compute/docs/access/iam
Tests:
- Name: IAM policy update on a Compute Disk
LogType: GCP.AuditLog
ExpectedResult: true
Log:
{
"insertId": "1abcd23efg456",
"labels": {
"compute.googleapis.com/root_trigger_id": "trigger-id-1"
},
"logName": "projects/test-project/logs/cloudaudit.googleapis.com%2Factivity",
"protoPayload": {
"@type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo": {
"principalEmail": "user@example.com",
"principalSubject": "serviceAccount:user@example.com",
"serviceAccountKeyName": "//iam.googleapis.com/projects/test-project/serviceAccounts/user@example.com/keys/key-id"
},
"authorizationInfo": [
{
"granted": true,
"permission": "compute.disks.setIamPolicy",
"resource": "projects/test-project/zones/us-central1-a/disks/disk-1",
"resourceAttributes": {
"name": "projects/test-project/zones/us-central1-a/disks/disk-1",
"service": "compute",
"type": "compute.disks"
}
}
],
"methodName": "v1.compute.disks.setIamPolicy",
"request": {
"@type": "type.googleapis.com/compute.disks.setIamPolicy",
"policy": {
"bindings": [
{
"members": [
"user:anonymized@example.com"
],
"role": "roles/owner"
}
]
}
},
"requestMetadata": {
"callerIP": "192.0.2.1",
"callerSuppliedUserAgent": "google-cloud-sdk",
"destinationAttributes": {},
"requestAttributes": {
"auth": {},
"time": "2023-10-01T12:34:56.789Z"
}
},
"resourceLocation": {
"currentLocations": [
"us-central1-a"
]
},
"resourceName": "projects/test-project/zones/us-central1-a/disks/disk-1",
"serviceName": "compute.googleapis.com"
},
"receiveTimestamp": "2023-10-01T12:34:57.123Z",
"resource": {
"labels": {
"disk_id": "disk-id-1",
"project_id": "test-project",
"zone": "us-central1-a"
},
"type": "gce_disk"
},
"severity": "NOTICE",
"timestamp": "2023-10-01T12:34:56.789Z"
}
- Name: IAM policy update on a Compute Image
LogType: GCP.AuditLog
ExpectedResult: true
Log:
{
"insertId": "2hijk34lmn789",
"labels": {
"compute.googleapis.com/root_trigger_id": "trigger-id-2"
},
"logName": "projects/test-project/logs/cloudaudit.googleapis.com%2Factivity",
"protoPayload": {
"@type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo": {
"principalEmail": "user@example.com",
"principalSubject": "serviceAccount:user@example.com",
"serviceAccountKeyName": "//iam.googleapis.com/projects/test-project/serviceAccounts/user@example.com/keys/key-id"
},
"authorizationInfo": [
{
"granted": true,
"permission": "compute.images.setIamPolicy",
"resource": "projects/test-project/global/images/image-1",
"resourceAttributes": {
"name": "projects/test-project/global/images/image-1",
"service": "compute",
"type": "compute.images"
}
}
],
"methodName": "v1.compute.images.setIamPolicy",
"request": {
"@type": "type.googleapis.com/compute.images.setIamPolicy",
"policy": {
"bindings": [
{
"members": [
"user:anonymized@example.com"
],
"role": "roles/owner"
}
]
}
},
"requestMetadata": {
"callerIP": "192.0.2.2",
"callerSuppliedUserAgent": "google-cloud-sdk",
"destinationAttributes": {},
"requestAttributes": {
"auth": {},
"time": "2023-10-01T12:45:56.789Z"
}
},
"resourceLocation": {
"currentLocations": [
"us-central1-a"
]
},
"resourceName": "projects/test-project/global/images/image-1",
"serviceName": "compute.googleapis.com"
},
"receiveTimestamp": "2023-10-01T12:45:57.123Z",
"resource": {
"labels": {
"image_id": "image-id-1",
"project_id": "test-project"
},
"type": "gce_image"
},
"severity": "NOTICE",
"timestamp": "2023-10-01T12:45:56.789Z"
}
- Name: Non-IAM policy update on a Compute Disk
LogType: GCP.AuditLog
ExpectedResult: false
Log:
{
"insertId": "4stuv78wxy345",
"labels": {
"compute.googleapis.com/root_trigger_id": "trigger-id-4"
},
"logName": "projects/test-project/logs/cloudaudit.googleapis.com%2Factivity",
"protoPayload": {
"@type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo": {
"principalEmail": "user@example.com",
"principalSubject": "serviceAccount:user@example.com",
"serviceAccountKeyName": "//iam.googleapis.com/projects/test-project/serviceAccounts/user@example.com/keys/key-id"
},
"authorizationInfo": [
{
"granted": true,
"permission": "compute.disks.create",
"resource": "projects/test-project/zones/us-central1-a/disks/disk-2",
"resourceAttributes": {
"name": "projects/test-project/zones/us-central1-a/disks/disk-2",
"service": "compute",
"type": "compute.disks"
}
}
],
"methodName": "v1.compute.disks.create",
"requestMetadata": {
"callerIP": "192.0.2.4",
"callerSuppliedUserAgent": "google-cloud-sdk",
"destinationAttributes": { },
"requestAttributes": {
"auth": { },
"time": "2023-10-01T13:00:00.000Z"
}
},
"resourceLocation": {
"currentLocations": [
"us-central1-a"
]
},
"resourceName": "projects/test-project/zones/us-central1-a/disks/disk-2",
"serviceName": "compute.googleapis.com"
},
"receiveTimestamp": "2023-10-01T13:00:01.000Z",
"resource": {
"labels": {
"disk_id": "disk-id-2",
"project_id": "test-project",
"zone": "us-central1-a"
},
"type": "gce_disk"
},
"severity": "NOTICE",
"timestamp": "2023-10-01T13:00:00.000Z"
}
Detection logic
Condition
protoPayload.response.error is_null
protoPayload.methodName in ["v1.compute.disks.setIamPolicy", "v1.compute.images.setIamPolicy", "v1.compute.snapshots.setIamPolicy"]
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
protoPayload.methodName | in |
|
protoPayload.response.error | is_null |
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
project | resource.labels.project_id |
principal | protoPayload.authenticationInfo.principalEmail |
caller_ip | protoPayload.requestMetadata.callerIP |
methodName | protoPayload.methodName |
resourceName | protoPayload.resourceName |
serviceName | protoPayload.serviceName |