Skip to main content

Event Information

  • What it is: google.login.LoginService.LoginFailure is a Cloud Logging audit/security event indicating a failed authentication attempt to a Google account identity (often via the Google login endpoint). In a GCP/org context, it usually precedes/blocks GCPIAM access because the principal never successfully authenticated.
  • Typical causes / fields to check:
    • Wrong password, 2‑Step Verification failure, disabled/suspended account, blocked by context‑aware access, device/trust policy, or risk‑based login protection.
    • Review authenticationInfo.principalEmail, metadata.reason / error, source IP / geolocation, user agent, and resource.labels.project_id to distinguish normal user error from suspicious activity.
  • Practical handling & compliance:
    • Monitor and alert on spikes or patterns (multiple failures for one account, single IP hitting many accounts, geo‑impossible logins) as indicators of brute‑force or credential‑stuffing; feed into SIEM (e.g., Chronicle, Splunk).
    • Use findings to enforce controls required by standards like ISO 27001, SOC 2, PCI DSS, HIPAA: enable strong MFA, context‑aware access, account lockout/throttling policies, and document incident response steps for repeated LoginFailure events.

Examples

  • Brute-force or credential-stuffing attempts on privileged accounts
    • Multiple google.login.LoginService.LoginFailure events from a small set of user accounts or service accounts, especially with admin/owner/organization-level roles, from the same or rotating IPs.
    • Risk: Possible account takeover attempt violating CIS GCP 1.x and NIST AC-7 (failed login monitoring). Mitigation: Implement IP-based throttling, enforce reCAPTCHA/2FA, and alert on high failure rates.
  • Suspicious geo-velocity / impossible travel with failed logins
    • LoginFailure events for the same principal from distant geographic regions or TOR/VPN exit nodes shortly before/after successful logins from another region.
    • Risk: Indicator of credential compromise impacting SOC 2 CC6, ISO 27001 A.8/A.12. Mitigation: Enforce Context-Aware Access, require strong MFA, and block high-risk locations or anonymizing networks.
  • Service account abuse and lateral movement attempts
    • Repeated LoginFailure events tied to service accounts or workload identities that should only be used by specific workloads, especially if originating from unusual projects, networks, or identities.
    • Risk: Potential lateral movement or privilege escalation violating PCI DSS 8.x and NIST AC-6. Mitigation: Restrict service account key usage, rotate keys, tighten IAM bindings, and create alerts on anomalous login sources for service accounts.

Remediation

Using Console

  • Harden authentication, context, and throttling (covers CIS 1.x, NIST AC-7, SOC2, ISO 27001, PCI DSS 8.x)
    • In GCP Console → IAM & Admin → Security → Authentication (or Security → Identity-Aware Proxy / Context-Aware Access depending on your setup):
      • Enforce MFA for admins/privileged users via your IdP or Google Workspace → Security → 2-step verification → Enforcement; require strong factors (FIDO2/security keys).
      • Enable Context-Aware Access (CAA): Admin Console → Security → Context-Aware Access; create access levels to block/step-up auth for:
        • High-risk geos or TOR/VPN ASNs.
        • Non-corporate IPs or untrusted device posture.
      • At your IdP or network edge (e.g., Cloud Armor): configure rate limiting / IP throttling for Google sign-in endpoints and administrative apps; add reCAPTCHA to any custom-facing login frontends.
    • GCP Console → Security → Security Command Center → Settings:
      • Ensure SCC Standard/Premium enabled; turn on Event Threat Detection to detect brute force and anomalous logins.
  • Strengthen IAM & service account controls to prevent lateral movement (covers NIST AC-6, PCI DSS 8.x)
    • GCP Console → IAM & Admin → IAM:
      • Filter by Role for Owner, Editor, Organization Admin, Project IAM Admin, Service Account User/Token Creator; remove or narrow bindings to principle of least privilege.
      • For any suspicious principals generating LoginFailure events, temporarily disable account (if user) or remove high-privilege roles until investigation completes.
    • GCP Console → IAM & Admin → Service Accounts:
      • For each high-value service account:
        • Disable key creation (Service account → Keys → Disable / don’t create new keys); delete unused keys and rotate active ones.
        • Under Permissions, remove broad roles (roles/editor, roles/owner, cross-project SA bindings) and replace with minimal, workload-specific roles.
        • Confirm usage: only from expected projects/networks (e.g., GCE, GKE); if LoginFailure events come from other sources, revoke keys, rotate credentials, and re-deploy workloads with new bindings.
  • Detect, alert, and investigate login anomalies (NIST AC-7, continuous monitoring controls)
    • GCP Console → Logging → Logs Explorer:
      • Query:
        Add filters for authenticationInfo.principalEmail and IP/geolocation fields to identify:
        • High failed-login counts from same/rotating IPs.
        • Same principal from distant regions in short time (impossible travel).
        • Service accounts failing logins from unexpected projects/networks.
    • GCP Console → Monitoring → Alerting → Create Policy:
      • Use Logs-based metrics on LoginFailure counts per principal/IP; create alerts when:
        • Failures exceed a threshold in N minutes (per user/IP).
        • Service accounts generate any interactive/abnormal login failures.
      • Route alerts to email / PagerDuty / SIEM; run playbooks: lock/disable suspicious accounts, force password reset, terminate active sessions, and document actions for SOC 2 / ISO 27001 evidence.

Using CLI

  • Detect and alert on brute-force / credential stuffing (CIS GCP 1.x, NIST AC-7)
    • Create a log-based metric on LoginFailure with filters such as:
    • Set an alert for high failure counts (e.g., >5 in 5 minutes) and notify your SOC:
      Example login_failure_alert.json snippet metric reference:
    • Reduce attack surface: enforce MFA and reCAPTCHA; for users, require security keys:
      For IP throttling / blocking, use Cloud Armor on external apps:
  • Mitigate impossible travel / suspicious geo-velocity (SOC 2 CC6, ISO 27001 A.8/A.12)
    • Use Context-Aware Access to enforce device/location conditions on high-privilege apps:
    • Restrict access to trusted countries and block TOR/VPN ranges via Cloud Armor for external apps:
    • Enforce MFA for all admins and set stronger session controls in Google Workspace / Cloud Identity (mapped to GCP org):
  • Constrain service account usage & detect abuse (PCI DSS 8.x, NIST AC-6)
    • Disable and rotate exposed keys; restrict key creation:
      Example org-policy-no-sa-keys.yaml snippet:
    • Tighten IAM bindings so SAs are only used by intended workloads:
    • Detect anomalous SA login sources with log-based metrics and alerts:
      Then create a Monitoring policy (similar to above) to alert on spikes or from unexpected projects/VPCs, and feed these into your SIEM for correlation with lateral movement patterns.

Using Python

  • Detection & alerting for brute-force / geo-velocity / service account abuse (Cloud Logging + Cloud Monitoring)
    • Enable Admin Activity / Access Transparency logs and aggregate google.login.LoginService.LoginFailure and google.login.LoginService.LoginSuccess into a log-based metric for failures per principal and per IP:
    • For geo-velocity: add a second metric that extracts requestMetadata.callerIp and enrich via SIEM or custom pipeline (Cloud Functions/Cloud Run) with GeoIP, then alert when same principalEmail has failures from distant countries within short intervals; treat TOR/VPN ASN lists as high-risk and feed into block lists / custom alerts.
  • Policy controls: Context-Aware Access, MFA, IP/location restrictions (compliance: SOC 2, ISO 27001, NIST AC-7/AC-6)
    • Enforce strong MFA and risk-based access for privileged accounts by assigning them to an access level that requires MFA and trusted device / network:
      • In Cloud Console or via Access Context Manager API, create access levels that restrict to corporate IP ranges / device attributes and attach them to IAM Conditions on admin roles (roles/owner, roles/editor, org-admin roles), satisfying NIST AC‑6 and SOC 2 CC6.
    • Use an Org Policy plus IAM Conditions to deny high-privilege logins from risky countries or anonymizers (integrate external IP reputation feeds into Conditions via request.time, request.attributes.origin.ip) and ensure shared service accounts used by workloads cannot be used from user IP ranges (only specific subnet tags / VPC connector), supporting PCI DSS 8.x.
    • Where feasible, enforce reCAPTCHA or per-app throttling in front-end apps that rely on Google Identity (to reduce credential stuffing) and configure Login Challenges in Google Workspace / Cloud Identity (MFA, device trust) for all admin groups.
  • Service account hardening & anomaly detection (PCI DSS 8.x, NIST AC-6)
    • Programmatically audit and restrict service account key usage, rotate keys, and detect anomalous login sources:
    • Bind service accounts only to specific workloads (GCE, GKE, Cloud Run) using least privilege and remove user or external principal impersonation rights (roles/iam.serviceAccountUser, roles/iam.serviceAccountTokenCreator) except where strictly necessary; monitor for LoginFailure from projects / networks where the SA should never be used and auto-open incidents or auto-disable keys via Cloud Functions.