Skip to main content

Event Information

  • Event Purpose & Semantics
    • google.iam.admin.v1.EnableServiceAccount indicates that a previously disabled service account has been re-enabled via the IAM API (e.g., projects.serviceAccounts.enable).
    • After this event, the service account can again obtain tokens, sign JWTs, and be used by workloads (Compute Engine, GKE, Cloud Run, CI/CD, etc.).
  • Security & Compliance Implications (e.g., SOC 2, ISO 27001, PCI DSS)
    • Re-enabling a service account can restore access to data and services; it is a privileged action that should be monitored and reviewed.
    • You should verify: who initiated the event, from where (IP, network), and whether the re-enablement aligns with change tickets or access requests; log and retain this as part of access-control and change-management evidence.
  • Practical Monitoring & Controls
    • Create Cloud Logging queries / Log-based metrics on protoPayload.methodName="google.iam.admin.v1.EnableServiceAccount" and alert in Cloud Monitoring when triggered, especially for high-privilege or production service accounts.
    • Use IAM Conditions and least-privilege roles so only tightly controlled admin identities (e.g., a break-glass group or CI pipeline with change records) can call iam.serviceAccounts.enable.

Examples

  • Re-enabling a previously disabled high-privilege service account
    • Example: A “ci-prod-deployer@project.iam.gserviceaccount.com” with roles/owner was disabled after an incident, but an attacker (or misconfigured pipeline) calls google.iam.admin.v1.EnableServiceAccount to bring it back and reuse its OAuth2 tokens or keys.
    • Impact: Violates least-privilege principles (ISO 27001 A.9, CIS GCP 1.0 Controls) and can re-open a closed incident path if no additional monitoring is in place.
  • Re-activating a service account used by exfiltration tooling
    • Example: A service account with roles/storage.admin was disabled during a data-leak investigation; enabling it again allows access to sensitive buckets containing regulated data (e.g., PCI, HIPAA/PHI, GDPR personal data).
    • Impact: Potential non-compliance with data-protection requirements (PCI DSS 3/7, HIPAA 164.308/310, GDPR Art. 32), as a known risky identity regains read/write permissions to sensitive datasets.
  • Bypassing change-control and SoD (Segregation of Duties)
    • Example: A DevOps user with broad IAM permissions enables a service account tied to production billing or key management (roles/cloudkms.admin, roles/billing.admin) outside of an approved change window.
    • Impact: Breaches change-management and SoD requirements (SOC 2 CC6/CC7, ISO 27001 A.12/A.15); can lead to unauthorized key operations, cost manipulation, or escalation of privileges via restored access to other GCP services.

Remediation

Using Console

  • Immediately contain and verify (Console + Org Policy)
    • In Cloud Console, go to IAM & Admin → Service Accounts, filter by name/email (e.g., ci-prod-deployer@...), and check Status, Last modified, and Keys; if the account must remain disabled, click the three‑dot menu → Disable (or Delete if formally decommissioned).
    • In IAM & Admin → Audit Logs, filter google.iam.admin.v1.EnableServiceAccount and identify who/what re-enabled it; revoke or tighten that principal’s IAM (e.g., remove roles/iam.serviceAccountAdmin / roles/owner) under IAM.
    • Under IAM & Admin → Organization Policies, enforce org policies like constraints/iam.disableServiceAccountKeyCreation, constraints/iam.allowedPolicyMemberDomains, and ensure high‑risk SAs are covered by a policy/process that prohibits ad‑hoc enabling without CAB/SoD approval.
  • Lock down risky service accounts and access paths
    • For incident‑related or high‑privilege SAs (exfil tooling, roles/owner, roles/storage.admin, roles/cloudkms.admin, roles/billing.admin):
      • In Service Accounts → [SA] → Keys, delete all keys; in Details, remove unneeded roles and convert to least‑privilege or set to disabled with clear description/tags (e.g., “QUARANTINED – do not enable”).
      • In IAM, remove broad roles from CI/CD service accounts and users; prefer custom roles limited to specific resources and actions required by pipelines.
    • In Security → Access Approval / Access Control (where applicable) and your ticketing system, require a documented, approved change (linked ticket) to re-enable any SA associated with PCI/PHI/GDPR data or production financial/key‑management functions.
  • Implement preventive and detective controls (monitoring + workflow)
    • In Cloud Monitoring → Logs Explorer, build a log‑based metric on EnableServiceAccount and alerts to security/on‑call channels for:
      • Any enable of SAs with specific labels (e.g., env=prod, critical=true) or high‑risk roles; configure alerting policies under Monitoring → Alerting.
    • Use Security Command Center (SCC) and/or Cloud Logging sinks to export IAM audit logs to a SIEM; create detections for:
      • Re‑enablement of disabled SAs, key creation, or assignment of powerful roles outside approved change windows.
    • Document a standard change workflow (aligned with ISO 27001, SOC 2, PCI, HIPAA): re‑enablement only via a tracked ticket, dual approval (SoD), post‑change review, and periodic recertification of all high‑privilege service accounts via IAM access reviews.

Using CLI

  • Immediate containment & forensic validation (who/what re-enabled it)
    • List and immediately disable the suspect service account; revoke keys and tokens:
    • Identify who/what re-enabled it using Cloud Audit Logs (map to change-control & SoD requirements):
    • For exfil-related accounts with storage or data roles, immediately remove high-risk bindings to protected resources:
  • Prevent re-enablement without formal change control & least privilege
    • Lock down who can enable/disable service accounts via IAM Conditions, aligning to ISO 27001 / SOC 2 / CIS GCP:
    • For permanently retired or incident-related accounts, disable and deny use with an organization policy and labels:
      • Optionally add an org policy to disallow iam.serviceAccounts.enable for non-security groups via custom org policy + Conditions (enforced at org/folder).
  • Monitoring, guardrails, and safer alternatives
    • Create an alert on any EnableServiceAccount for high-privilege roles (PCI/ HIPAA/GDPR evidence):
    • Replace broad roles with least-privilege custom roles and use short-lived Workload Identity Federation for CI/CD instead of long-lived keys:

Using Python

  • Immediate technical containment & enforcement (org policy, deny, and guardrails)
    • Create an org-level Deny Policy that blocks re-enabling high‑risk service accounts except through a controlled group (GCP IAM Deny, preview/GA dependent):
      deny-enable-protected-sas.yaml (example):
    • Where org‑level deny isn’t available, move critical SAs into a locked “admin only” project/folder and strip roles/iam.serviceAccountAdmin / roles/owner from CI users. Use pre‑defined custom roles with no iam.serviceAccounts.enable or iam.serviceAccounts.undelete permissions.
    • For exfiltration‑related SAs, also add: VPC‑SC around sensitive projects, CMEK protections, and bucket‑level conditional IAM (e.g., request.time < decommission_time) to ensure PCI/HIPAA/GDPR stores cannot be reached even if the SA is re‑enabled.
  • Detection, monitoring, and change-control guardrails (Cloud Audit Logs + SCC + pipeline checks)
    • Enable Data Access logs for iam.googleapis.com and build log‑based alerts for google.iam.admin.v1.EnableServiceAccount on tagged “protected” SAs (e.g., label risk_level=high), integrating with SIEM and ticketing to satisfy SOC 2 / ISO 27001 change‑management evidence.
    • Example Python script (Cloud Functions / Cloud Run) to auto‑re-disable protected SAs when an enable event is detected (triggered from Pub/Sub -> Log Sink):
    • Add a pipeline‑side control: Python pre‑deployment check to fail CI/CD jobs if they attempt to enable blocked SAs (meets SoD / change‑control). Example snippet in a job step:
  • Lifecycle cleanup, least-privilege redesign, and compliance alignment
    • For formerly compromised / exfiltration SAs: permanently delete instead of disable where possible, rotate all keys/tokens, and re‑implement workloads using narrowly scoped SAs (workload‑identity with per‑bucket / per‑KMS‑key roles). Document in incident records for PCI DSS / HIPAA / GDPR and ensure DLP / access reviews reflect the removal.
    • Implement periodic Python-driven review of high‑privilege SAs (mapping to ISO 27001 A.9 & CIS GCP 1.0):
    • Embed approvals (CAB / dual control) before any change that enables or modifies high‑privilege SAs: enforce via separate “requester” vs “approver” groups (SoD), and store approvals in a system of record linked to the underlying API calls/logs.