GCP IAM
SETIAMPOLICY
SA KEYS
AUDIT LOGS
DetectionBlue TeamSOCOctober 12, 2026•9 min read

Detecting GCP IAM Abuse in Cloud Audit Logs

In GCP, access is policy bindings on resources. The attacker’s shortest route is to rewrite a binding or mint a service account key, and both are audited.

Scroll

Google Cloud grants access through IAM policy bindings on organisations, folders, projects and resources, and through service accounts that can be impersonated or issued keys. An attacker with a foothold escalates by adding a binding for themselves, creating a long-lived service account key, or impersonating a more privileged account. These actions appear in Admin Activity audit logs, which are on by default and cannot be disabled.

Signals at a Glance

SignalWhereATT&CK
SetIamPolicy adding owner, editor or security-admin style bindingsAdmin Activity audit logsT1098.003
CreateServiceAccountKey, especially user-managed keysAdmin Activity audit logsT1098.001
GenerateAccessToken or signJwt impersonation across service accountsData Access audit logsT1078.004
New service account created and granted roles within minutesAdmin Activity audit logsT1136.003
External or allUsers principals added to a policyAdmin Activity audit logsT1098

Logs Explorer Filters

Admin Activity logs record policy changes and key creation. This filter is a good starting alert in Logs Explorer or a log-based alert, and narrows to the methods that matter:

# Cloud Logging filter - IAM policy changes and service account key creation
logName:"cloudaudit.googleapis.com%2Factivity"
AND (
  protoPayload.methodName="SetIamPolicy"
  OR protoPayload.methodName="google.iam.admin.v1.CreateServiceAccountKey"
  OR protoPayload.methodName="google.iam.admin.v1.UploadServiceAccountKey"
  OR protoPayload.methodName="google.iam.admin.v1.CreateServiceAccount"
  OR protoPayload.methodName="google.iam.admin.v1.SetIAMPolicy"
)
AND NOT protoPayload.authenticationInfo.principalEmail:"@your-automation-project.iam.gserviceaccount.com"
# tune/validate: confirm methodName strings in your own logs; Terraform and deployment service accounts need an allowlist

BigQuery Over Exported Logs

If you export audit logs to BigQuery, SQL gives you joins, baselines and history. This query lists IAM policy changes and the principals that made them, which you can compare with a list of approved administrators:

-- BigQuery SQL - IAM policy changes and key creation from exported Admin Activity logs
-- validate: the table name depends on your sink; the dataset below is a placeholder
SELECT
  timestamp,
  protopayload_auditlog.authenticationInfo.principalEmail AS actor,
  protopayload_auditlog.requestMetadata.callerIp AS caller_ip,
  protopayload_auditlog.methodName AS method,
  protopayload_auditlog.resourceName AS resource,
  protopayload_auditlog.authorizationInfo AS authz
FROM `my-project.audit_logs.cloudaudit_googleapis_com_activity_*`
WHERE _TABLE_SUFFIX >= FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY))
  AND protopayload_auditlog.methodName IN (
        'SetIamPolicy',
        'google.iam.admin.v1.CreateServiceAccountKey',
        'google.iam.admin.v1.UploadServiceAccountKey')
  AND protopayload_auditlog.authenticationInfo.principalEmail NOT IN (SELECT email FROM `my-project.reference.approved_iam_admins`)
ORDER BY timestamp DESC;
Vetted sources

Use Google Cloud audit logging documentation, Security Command Center Event Threat Detection finding categories, the SigmaHQ GCP rules and Elastic GCP detection rules. Baseline your own environment, because infrastructure-as-code service accounts perform most legitimate IAM changes.

Build Detections That Fire

Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.

Detection EngineeringManaged Detection & ResponseThreat HuntingIncident ResponsePurple Teaming
  • Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
  • Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
  • 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Written by: Mjolnir Threat Research (MTAC)  |  Published: October 12, 2026  |  Last reviewed: October 12, 2026