A Google Cloud service account key is a long-lived credential, usually a JSON file containing a private key, that lets an application authenticate as a service account from outside Google Cloud. Leaked keys in repositories or build logs give attackers that account's permissions. Defenders audit and delete unused keys, restrict key creation, and prefer short-lived alternatives like workload identity federation.
What a Google Cloud service account key is in practice
A Google Cloud service account key is a long-lived JSON credential that authenticates an application as a service account from outside Google Cloud. Because it is portable and durable, the key behaves like a bearer secret: anyone who obtains it can use the service account’s permissions until the key is revoked or replaced.
That makes the key different from short-lived identity tokens or federation-based approaches. The core security issue is not just that the file is sensitive, but that it can outlive the original deployment context and be copied into source control, logs, build artifacts or developer machines.
Why service account keys are risky
The main risk is credential replay. If an attacker steals the JSON key, they do not need to compromise Google Cloud directly, they can simply authenticate as the workload from anywhere they can reach the API. The blast radius is determined by the service account’s permissions, so a broadly privileged account turns one leaked file into wide cloud access.
Keys also create hidden exposure because they are easy to duplicate and hard to track once distributed. A forgotten key in a legacy script, CI job or archived repository can remain valid long after the team has lost sight of it. For that reason, NHI security guidance treats long-lived cloud credentials as a lifecycle problem, not just a secret-storage problem, and the broader Cloud Access Key Leak Playbook is useful when leaked cloud credentials need containment, rotation and post-incident review.
How organisations assess exposure and replace keys
Exposure review starts with inventory: which service account keys exist, where they are used, and whether any are internet-reachable through repositories, CI/CD systems, endpoint backups or shared storage. Google Cloud teams typically validate this with asset inventory, key usage telemetry and vendor controls, then map each key to the workload or integration that still depends on it. The Google Cloud Service Account Keys Security Guide covers the practical path from discovery to safe retirement.
Replacement is usually the long-term fix. Short-lived credentials, service account impersonation and workload identity federation reduce the need for static keys because the application no longer carries a reusable private key file. The Cloud Workload Identity Guide explains the broader keyless model, while the guide to inventory Google Cloud service account keys and replace them with federation focuses on the migration path.
Where Google Cloud keys fit in modern workload identity
Service account keys are one way to prove a workload’s identity, but they are usually the weakest option because the proof is static and replayable. Modern patterns prefer ephemeral trust: the workload exchanges its runtime context for short-lived access instead of storing a reusable secret. That shifts security from secret handling to trust establishment, token lifetime and policy enforcement.
For Google Cloud specifically, this means preferring impersonation and federation where possible, and limiting keys to the smallest number of exceptional cases. The choice is not only technical but architectural: if a workload can authenticate without a JSON key, then there is no file to leak, rotate or accidentally reuse across environments.
Risk and Threat Considerations
Leaked service account keys are a direct compromise path because they turn secret exposure into authenticated cloud access. Attackers commonly look for these files in public repositories, build logs, developer workstations and backup systems, then use the associated permissions for data access, persistence or lateral movement.
Failure mechanism: A long-lived private key remains valid after disclosure, so the attacker can replay it until the key is revoked or the service account is disabled.
Impact: The resulting access can expose data, modify cloud resources, create persistence, or abuse any downstream permissions granted to the service account.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Leaked service account keys are long-lived secrets that enable account takeover. |
| NHI-07 — Long-Lived Secrets | Google Cloud service account keys are durable credentials with extended blast radius. | |
| Recommendation — Detect, store and retire exposed service account keys before attackers can replay them. Replace static keys with short-lived workload identity or federation wherever possible. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Service account keys are authenticators whose lifecycle must be controlled and revoked. |
| IA-9 — Service Identification and Authentication | Workloads and services authenticate with machine credentials such as service account keys. | |
| AC-6 — Least Privilege | Compromise impact depends on the permissions attached to the service account. | |
| Recommendation — Manage key issuance, rotation and revocation as controlled authenticator lifecycle events. Use service-to-service authentication patterns that avoid reusable static keys. Constrain service account permissions so a stolen key cannot grant broad access. | ||
| CIS Controls v8 | CIS-5 — Account Management | Key inventory, lifecycle control and removal of unused access align with account governance. |
| Recommendation — Inventory service account keys and remove unused or unowned credentials promptly. | ||
Practitioner Guidance
Why practitioners should care: Treat Google Cloud service account keys as exception-only credentials, not as a normal application authentication pattern. Their main operational danger is not just theft, but silent accumulation across repositories, pipelines and forgotten integrations. The Service Account Security Guide is useful when setting governance for discovery, ownership and retirement.
What to watch for: Repeated key creation, old keys with no recent use, keys embedded in code or CI secrets stores, and service accounts that still have broad permissions long after the original integration changed.
Practitioner takeaway: If a Google Cloud workload can authenticate without a downloaded JSON key, that is usually the safer design, because it removes a reusable secret from the attack path.
Related resources from NHI Mgmt Group
- How should security teams investigate service account key usage in Google Cloud?
- How do you audit who holds the Google Cloud Service Account Key Admin Role?
- What should replace the Google Cloud Service Account Key Admin role for least privilege?
- What should be used instead of the Google Cloud Service Account API Key Binding Admin Role for least privilege?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org