Detection rules › Panther
GCP Cloud Run Set IAM Policy
Detects new roles granted to users to Cloud Run Services. This could potentially allow the user to perform actions within the project and its resources, which could pose a security risk.
Rule body yaml
AnalysisType: rule
LogTypes:
- GCP.AuditLog
Description:
Detects new roles granted to users to Cloud Run Services. This could potentially allow the user to perform
actions within the project and its resources, which could pose a security risk.
DisplayName: "GCP Cloud Run Set IAM Policy"
RuleID: "GCP.Cloud.Run.Set.IAM.Policy"
Enabled: true
Filename: gcp_cloud_run_set_iam_policy.py
Reference: https://cloud.google.com/run/docs/securing/managing-access
Runbook: Confirm this was authorized and necessary behavior
Severity: High
DedupPeriodMinutes: 60
Threshold: 1
Tests:
- Name: GCP Run IAM Policy Set
ExpectedResult: true
Log:
{
"insertId": "l3jvzyd2s2s",
"logName": "projects/some-project/logs/cloudaudit.googleapis.com%2Factivity",
"protoPayload":
{
"at_sign_type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo":
{
"principalEmail": "some.user@company.com",
"principalSubject": "user:some.user@company.com",
},
"authorizationInfo":
[
{
"granted": true,
"permission": "run.services.setIamPolicy",
"resource": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
"resourceAttributes": {},
},
{
"granted": true,
"permission": "run.services.setIamPolicy",
"resourceAttributes": {},
},
],
"methodName": "google.cloud.run.v1.Services.SetIamPolicy",
"request":
{
"@type": "type.googleapis.com/google.iam.v1.SetIamPolicyRequest",
"policy":
{
"bindings":
[
{
"members": ["user:some.user@company.com"],
"role": "roles/run.invoker",
},
],
},
"resource": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
},
"requestMetadata":
{
"callerIP": "1.2.3.4",
"callerSuppliedUserAgent": "(gzip),gzip(gfe)",
"destinationAttributes": {},
"requestAttributes":
{ "auth": {}, "time": "2024-02-02T09:44:26.173186Z" },
},
"resourceLocation": { "currentLocations": ["us-west1"] },
"resourceName": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
"response":
{
"@type": "type.googleapis.com/google.iam.v1.Policy",
"bindings":
[
{
"members": ["user:some.user@company.com"],
"role": "roles/run.invoker",
},
],
"etag": "BwYQYvUoBxs=",
},
"serviceName": "run.googleapis.com",
},
"receiveTimestamp": "2024-02-02 09:44:26.653891982",
"resource":
{
"labels":
{
"configuration_name": "",
"location": "us-west1",
"project_id": "some-project",
"revision_name": "",
"service_name": "",
},
"type": "cloud_run_revision",
},
"severity": "NOTICE",
"timestamp": "2024-02-02 09:44:26.029835000",
}
- Name: GCP Run IAM Policy Not Set
ExpectedResult: false
Log:
{
"insertId": "l3jvzyd2s2s",
"logName": "projects/some-project/logs/cloudaudit.googleapis.com%2Factivity",
"protoPayload":
{
"at_sign_type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo":
{
"principalEmail": "some.user@company.com",
"principalSubject": "user:some.user@company.com",
},
"authorizationInfo":
[
{
"granted": false,
"permission": "run.services.setIamPolicy",
"resource": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
"resourceAttributes": {},
},
{
"granted": false,
"permission": "run.services.setIamPolicy",
"resourceAttributes": {},
},
],
"methodName": "google.cloud.run.v1.Services.SetIamPolicy",
"request":
{
"@type": "type.googleapis.com/google.iam.v1.SetIamPolicyRequest",
"policy":
{
"bindings":
[
{
"members": ["user:some.user@company.com"],
"role": "roles/run.invoker",
},
],
},
"resource": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
},
"requestMetadata": ...,
"resourceLocation": ...,
"resourceName": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
"serviceName": "run.googleapis.com",
},
"receiveTimestamp": "2024-02-02 09:44:26.653891982",
"resource": ...,
"severity": "NOTICE",
"timestamp": "2024-02-02 09:44:26.029835000",
}
- Name: No method provided
ExpectedResult: false
Log:
{
"insertId": "l3jvzyd2s2s",
"logName": "projects/some-project/logs/cloudaudit.googleapis.com%2Factivity",
"protoPayload":
{
"at_sign_type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo":
{
"principalEmail": "some.user@company.com",
"principalSubject": "user:some.user@company.com",
},
"authorizationInfo":
[
{
"granted": false,
"permission": "run.services.setIamPolicy",
"resource": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
"resourceAttributes": {},
},
{
"granted": false,
"permission": "run.services.setIamPolicy",
"resourceAttributes": {},
},
],
"request":
{
"@type": "type.googleapis.com/google.iam.v1.SetIamPolicyRequest",
"policy":
{
"bindings":
[
{
"members": ["user:some.user@company.com"],
"role": "roles/run.invoker",
},
],
},
"resource": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
},
"requestMetadata": ...,
"resourceLocation": ...,
"resourceName": "projects/some-project/locations/us-west1/services/cloudrun-exfil",
"serviceName": "run.googleapis.com",
},
"receiveTimestamp": "2024-02-02 09:44:26.653891982",
"resource": ...,
"severity": "NOTICE",
"timestamp": "2024-02-02 09:44:26.029835000",
}
Detection logic
Condition
severity ne "ERROR"
protoPayload.methodName ends_with "Services.SetIamPolicy"
protoPayload.authorizationInfo is_not_null
protoPayload.authorizationInfo array_any
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.authorizationInfo | is_not_null | |
protoPayload.methodName | ends_with |
|
severity | ne |
|
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 |