GCP Cloud Run Service Created WITH Set IAM Policy
Description
Detects run.services.create method for privilege escalation in GCP. The exploit creates a new Cloud Run Service that, when invoked, returns the Service Account's access token by accessing the metadata API of the server it is running on.
Query
Detection:
- Group:
- ID: ServiceCreated
RuleID: GCP.Cloud.Run.Service.Created
- ID: SetIAMPolicy
RuleID: GCP.Cloud.Run.Set.IAM.Policy
MatchCriteria:
field_name:
- GroupID: ServiceCreated
Match: p_alert_context.caller_ip
- GroupID: SetIAMPolicy
Match: p_alert_context.caller_ip
LookbackWindowMinutes: 1800
Schedule:
RateMinutes: 1440
TimeoutMinutes: 5
Rule dependencies
⚠ Higher-order rule. It fires on other rules' alerts, not on raw events, so it cannot fire on its own. Deploy the rules it depends on too.
Depends on
-
correlates · Panther group
GCP.Cloud.Run.Service.Createdwithin 1800m -
correlates · Panther group
GCP.Cloud.Run.Set.IAM.Policywithin 1800m
Analyst notes
Confirm this was authorized and necessary behavior