How the attack works
A stolen service account key, an access token taken from a workload or a phished user session does not come with a list of what it may do. Reading the allow policies would answer that, but it needs permissions the credential often lacks. So the attacker tries. They call one method after another, across services, and note which calls succeed. A workload behaves differently. It calls the few methods it was built for, and when a permission is missing it fails on the same method again and again.
Cloud Audit Logs record refused calls as well as successful ones. The status field of the audit entry holds the result, and a refusal for lack of permission has the code 7, which is PERMISSION_DENIED in Google's RPC status codes. Google's Event Threat Detection has a finding for this pattern, Initial Access, Excessive Permission Denied Actions, which fires when a principal repeatedly triggers permission denied errors across multiple methods and services, and Google's response steps for it filter the logs on protoPayload.status.code=7. Google lists Admin Activity logs as the source of that finding, so denied attempts to change something are visible without any extra configuration. Denied read calls belong to Data Access logs, which exist only where they are enabled.
A credential that can read allow policies does not need to guess. A further rule matches a service account that reads the allow policy of a project, folder or organization (getIamPolicy of cloudresourcemanager.googleapis.com, a Data Access entry), which Google's Event Threat Detection reports as Discovery, Service Account Self-Investigation.
What an attacker needs
- A valid credential for any Google Cloud principal, such as a service account key, a token from a compromised workload or a user session.
- No further permission is needed. The technique consists of finding out which permissions the credential has.
Impact
The attacker learns what the credential can do and where, without reading a single allow policy. That tells them which data they can reach and which escalation paths are open, and it shapes everything that follows. The probing itself changes nothing, but every call that was not denied in the same burst is something the attacker now knows how to use.
Detection rules
Google Cloud API Calls Denied in Many Services for One Principal
Counts, per caller (principalEmail), in how many different Google Cloud services (protoPayload.serviceName) a call was refused for lack of permission. Denied calls in four or more services within 10 minutes show breadth. A workload calls the few services it was built for, while someone who tests a credential walks through services it has never used. Google describes its own finding for this pattern as permission denied errors across multiple methods and services. The rule complements the count of different denied methods on this page, which one misbehaving application can reach inside a single service. The base event is an audit entry with protoPayload.status.code 7. Denied read calls are counted only where Data Access audit logs are enabled. The count and the window are starting points to tune and are not Google's.
Fires when one protoPayload.authenticationInfo.principalEmail has at least 4 different protoPayload.serviceName values within 10 minutes.
title: Google Cloud API Call Denied for Lack of Permission (Denied Services Base Event)
id: ecb7d480-0a20-49c4-9cd0-2b4207f0aff8
name: gcp_api_call_permission_denied_services
status: experimental
description: >-
Base event of the threshold rule in this file. A Cloud Audit Logs entry
whose status code is 7, which is PERMISSION_DENIED. The code is matched as
a prefix because the Sentinel query reads it as text. Google's RPC status
codes run from 0 to 16, so only 7 matches.
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.status.code|startswith: '7'
condition: selection
level: low
---
title: Google Cloud API Calls Denied in Many Services for One Principal
id: e1f4c902-bde3-4531-acb5-aca8318dd6a4
status: experimental
description: >-
Counts, per caller (principalEmail), in how many different Google Cloud
services (protoPayload.serviceName) a call was refused for lack of
permission. Denied calls in four or more services within 10 minutes show
breadth. A workload calls the few services it was built for, while
someone who tests a credential walks through services it has never used.
Google describes its own finding for this pattern as permission denied
errors across multiple methods and services. The rule complements the
count of different denied methods on this page, which one misbehaving
application can reach inside a single service. The base event is an audit
entry with protoPayload.status.code 7. Denied read calls are counted only
where Data Access audit logs are enabled. The count and the window are
starting points to tune and are not Google's.
references:
- https://docs.cloud.google.com/security-command-center/docs/findings/threats/excessive-failed-attempt
- https://docs.cloud.google.com/security-command-center/docs/concepts-event-threat-detection-overview
- https://docs.cloud.google.com/logging/docs/reference/audit/auditlog/rest/Shared.Types/AuditLog
author: Forestall
date: 2026-11-18
tags:
- attack.discovery
- attack.t1580
correlation:
type: value_count
rules:
- gcp_api_call_permission_denied_services
group-by:
- protoPayload.authenticationInfo.principalEmail
timespan: 10m
condition:
field: protoPayload.serviceName
gte: 4
falsepositives:
- Security posture scanners and inventory tools whose service account lacks part of the permissions they try. Exclude those principals or complete their roles.
- The values of 4 services and 10 minutes are starting points, not tested limits. Measure what your own tools produce and adjust both.
level: medium
False positives
- Security posture scanners and inventory tools whose service account lacks part of the permissions they try. Exclude those principals or complete their roles.
- The values of 4 services and 10 minutes are starting points, not tested limits. Measure what your own tools produce and adjust both.
Many Different Google Cloud Methods Denied for One Principal
Counts, per caller (principalEmail), how many different API methods were refused for lack of permission. Ten or more different methods within 10 minutes is the pattern of a credential being tested for what it can do. A workload that lacks one permission fails on the same method repeatedly and stays below the count. The base event is an audit entry with protoPayload.status.code 7, the filter Google gives in the response steps of its Event Threat Detection finding for excessive permission denied actions. Google lists Admin Activity logs as the source of that finding, so denied attempts to change something are counted without extra configuration. Denied read calls are counted only where Data Access audit logs are enabled, and Google documents that the caller's address might be redacted for denied read-only operations unless the caller is a service account. The count and the window are starting points to tune and are not Google's.
Fires when one protoPayload.authenticationInfo.principalEmail has at least 10 different protoPayload.methodName values within 10 minutes.
title: Google Cloud API Call Denied for Lack of Permission (Denied Methods Base Event)
id: c1df04a4-30eb-47ad-aca8-78f5bfb359d4
name: gcp_api_call_permission_denied_methods
status: experimental
description: >-
Base event of the threshold rule in this file. A Cloud Audit Logs entry
whose status code is 7, which is PERMISSION_DENIED. The code is matched as
a prefix because the Sentinel query reads it as text. Google's RPC status
codes run from 0 to 16, so only 7 matches.
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.status.code|startswith: '7'
condition: selection
level: low
---
title: Many Different Google Cloud Methods Denied for One Principal
id: c68c1e4c-23a9-4585-964f-e9efb1963ffd
status: experimental
description: >-
Counts, per caller (principalEmail), how many different API methods were
refused for lack of permission. Ten or more different methods within 10
minutes is the pattern of a credential being tested for what it can do.
A workload that lacks one permission fails on the same method repeatedly
and stays below the count. The base event is an audit entry with
protoPayload.status.code 7, the filter Google gives in the response steps
of its Event Threat Detection finding for excessive permission denied
actions. Google lists Admin Activity logs as the source of that finding,
so denied attempts to change something are counted without extra
configuration. Denied read calls are counted only where Data Access audit
logs are enabled, and Google documents that the caller's address might be
redacted for denied read-only operations unless the caller is a service
account. The count and the window are starting points to tune and are
not Google's.
references:
- https://docs.cloud.google.com/security-command-center/docs/findings/threats/excessive-failed-attempt
- https://docs.cloud.google.com/logging/docs/reference/audit/auditlog/rest/Shared.Types/AuditLog
- https://docs.cloud.google.com/logging/docs/audit
author: Forestall
date: 2026-11-18
tags:
- attack.discovery
- attack.t1580
correlation:
type: value_count
rules:
- gcp_api_call_permission_denied_methods
group-by:
- protoPayload.authenticationInfo.principalEmail
timespan: 10m
condition:
field: protoPayload.methodName
gte: 10
falsepositives:
- Security posture scanners and inventory tools whose service account lacks part of the permissions they try, and administrators who browse the console with a narrow role. Exclude those principals or complete their roles.
- A deployment that fails halfway because a role is missing can touch several methods. Those bursts stop when the role is fixed.
- The values of 10 methods and 10 minutes are starting points, not tested limits. Measure what your own tools produce and adjust both.
level: medium
False positives
- Security posture scanners and inventory tools whose service account lacks part of the permissions they try, and administrators who browse the console with a narrow role. Exclude those principals or complete their roles.
- A deployment that fails halfway because a role is missing can touch several methods. Those bursts stop when the role is fixed.
- The values of 10 methods and 10 minutes are starting points, not tested limits. Measure what your own tools produce and adjust both.
Service Account Read the IAM Policy of a Project, Folder or Organization in Google Cloud
Detects a service account reading the allow policy of a project, folder or organization through Cloud Resource Manager (getIamPolicy, any API version). A stolen service account credential is often used first to find out what the account may do, and the allow policy answers that. Google's Event Threat Detection raises the finding Discovery, Service Account Self-Investigation when a service account credential is used to investigate its own roles and permissions, and names projects.getIamPolicy in its response steps. The rule matches the call whether it was allowed or denied. Read calls are Data Access entries (ADMIN_READ), so the rule needs Data Access audit logs enabled for Cloud Resource Manager. Google-managed service agents in their most common address format, which contains @gcp-sa-, are excluded. Google lists other formats for some service agents and says the format may change.
title: Service Account Read the IAM Policy of a Project, Folder or Organization in Google Cloud
id: 9c3bfe04-6df3-41f7-a22d-598403e6fe0c
status: experimental
description: >-
Detects a service account reading the allow policy of a project, folder or
organization through Cloud Resource Manager (getIamPolicy, any API
version). A stolen service account credential is often used first to find
out what the account may do, and the allow policy answers that. Google's
Event Threat Detection raises the finding Discovery, Service Account
Self-Investigation when a service account credential is used to
investigate its own roles and permissions, and names projects.getIamPolicy
in its response steps. The rule matches the call whether it was allowed or
denied. Read calls are Data Access entries (ADMIN_READ), so the rule needs
Data Access audit logs enabled for Cloud Resource Manager. Google-managed
service agents in their most common address format, which contains
@gcp-sa-, are excluded. Google lists other formats for some service agents
and says the format may change.
references:
- https://docs.cloud.google.com/security-command-center/docs/findings/threats/iam-anomalous-behavior-service-account-gets-own-iam-policy
- https://docs.cloud.google.com/resource-manager/docs/audit-logging
- https://docs.cloud.google.com/iam/docs/service-agents
- https://attack.mitre.org/techniques/T1580/
author: Forestall
date: 2026-11-18
tags:
- attack.discovery
- attack.t1580
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: cloudresourcemanager.googleapis.com
protoPayload.methodName|endswith: getIamPolicy
protoPayload.authenticationInfo.principalEmail|endswith: .gserviceaccount.com
filter_service_agents:
protoPayload.authenticationInfo.principalEmail|contains: '@gcp-sa-'
condition: selection and not 1 of filter_*
falsepositives:
- Service agents in the other address formats Google lists, such as PROJECT_NUMBER@cloudservices.gserviceaccount.com. Add them to the filter_service_agents selection when they appear.
- Infrastructure-as-code pipelines, inventory and posture tools that run as service accounts and read allow policies on every run. Add their service accounts to a filter_* selection on principalEmail, and treat a read by any other service account as worth a look, above all when the entry carries authenticationInfo.serviceAccountKeyName, which shows that a user-managed key was used.
level: medium
False positives
- Service agents in the other address formats Google lists, such as PROJECT_NUMBER@cloudservices.gserviceaccount.com. Add them to the filter_service_agents selection when they appear.
- Infrastructure-as-code pipelines, inventory and posture tools that run as service accounts and read allow policies on every run. Add their service accounts to a filter_* selection on principalEmail, and treat a read by any other service account as worth a look, above all when the entry carries authenticationInfo.serviceAccountKeyName, which shows that a user-managed key was used.
Triage
- Identify the principal (protoPayload.authenticationInfo.principalEmail) and list the denied methods and services in the burst. Many unrelated services point to probing. One method repeated points to a misconfigured workload.
- Look at where the calls came from in protoPayload.requestMetadata.callerIp and callerSuppliedUserAgent, and compare both with the principal's normal use.
- List the calls by the same principal in the same period that were not denied. Those show what the credential can do and what the attacker may already have done.
- For a service account, find out how its credential could have left its workload. Check for user-managed keys, and in the entries for authenticationInfo.serviceAccountKeyName, which names the key that was used.
- Check whether a security scanner or an inventory tool runs under this principal, and whether a role it relied on was removed recently.
Response
Once the attack is confirmed:
- Disable the credential that was used. Disable or delete the service account key, or disable the service account, or for a user reset the password and end the sessions.
- Review every call by the principal that succeeded during and after the burst, and undo changes such as new keys, role bindings and resources.
- Find how the credential was exposed, for example in a repository, on a compromised VM or in a build log, and close that path.
- Reduce the roles of the principal to what its workload needs before it is enabled again.
- Search for the same source address and user agent with other principals, since one compromise often exposes several credentials.
Mitigation
- Give each workload its own service account with only the roles it needs, so that a stolen credential finds little that works.
- Prefer attached service accounts and Workload Identity Federation over service account keys, which can be used from anywhere once they leak.
- Enable Data Access audit logs for the services that matter most, so that denied read calls are recorded as well as denied changes.
- Use VPC Service Controls or context-aware access where they fit, so that a credential used from outside the expected network is refused.
- Fix workloads that produce permission denied errors in normal operation. A quiet baseline is what makes a probing burst stand out.
Frequently asked questions
Which denied calls does Google Cloud record?
Audit entries are written for refused calls as well, with the result in the `status` field. Which log they go to follows the method. Google lists Admin Activity logs as the source of its own finding for this pattern, so denied attempts to change something are always recorded. Denied read calls are Data Access entries, which exist only where Data Access logs are enabled for the service.
What does status code 7 mean?
It is `PERMISSION_DENIED` in Google's RPC status codes, the code a service returns when the caller does not have permission to execute the operation. Google's response steps for the finding Excessive Permission Denied Actions filter the logs on `protoPayload.status.code=7` together with the principal. A caller that cannot be identified at all gets a different code, `UNAUTHENTICATED`.
Why might the rules miss a person who probes with read calls?
Two reasons. Read calls are Data Access entries and are only logged where those logs are enabled. And Google documents that for read-only operations that fail with permission denied, the caller's email address might be redacted unless the caller is a service account. The rules group by that address, so redacted entries are not counted for the person.
Does Google detect this itself?
Event Threat Detection has the finding Initial Access, Excessive Permission Denied Actions, for a principal that repeatedly triggers permission denied errors by attempting changes across multiple methods and services. It needs Security Command Center. Google does not publish the threshold of that finding. The counts in the rules on this page are starting points of their own and are not taken from it.
References
- MITRE ATT&CK T1580: Cloud Infrastructure Discovery
- Security Command Center finding: Initial Access, Excessive Permission Denied Actions
- Event Threat Detection overview
- AuditLog reference (status, authenticationInfo, requestMetadata)
- Cloud Audit Logs overview (caller identities in audit logs)
- google.rpc.Code (PERMISSION_DENIED)
- Respond to compromised Google Cloud credentials
- Security Command Center finding: Discovery, Service Account Self-Investigation
- Resource Manager audit logging (getIamPolicy is a Data Access entry)
- Service agents