Detection scenarios
How do I detect an attacker in my Google Cloud (GCP) environment?
Detecting an attacker in Google Cloud: direct answer
Detect an attacker in Google Cloud by watching for leaked service account keys in use, unusual impersonation, new IAM grants, changes to log sinks and reads of secrets by identities that have never read them. Cloud Audit Logs record that activity, Security Command Center's Event Threat Detection turns much of it into findings, and canary resources add a signal with no legitimate use. Tracebit, a deception technology platform that detects attacks in your environment at scale, deploys and manages canaries across GCP projects as infrastructure as code, through the same motion it uses for AWS and Azure. The catch on Google Cloud is logging: Data Access audit logs, which record reads, are off by default for almost every service.
Signals that an attacker is in your Google Cloud environment
| Signal | Where it shows up | What to look for | Noise |
|---|---|---|---|
| Leaked or dormant credentials in use | Event Threat Detection | Initial Access: Leaked Service Account Key Used, Initial Access: Dormant Service Account Action | Low |
| A service account checking its own access | Event Threat Detection, Audit Logs | Discovery: Service Account Self-Investigation, testIamPermissions | Medium |
| Anonymised access | Event Threat Detection | Evasion: Access from Anonymizing Proxy | Low to medium |
| New IAM grants | Admin Activity logs, Event Threat Detection | SetIamPolicy, Persistence: IAM Anomalous Grant | Medium. Automation does this too |
| New keys and impersonation | Admin Activity and Data Access logs | CreateServiceAccountKey, GenerateAccessToken, Privilege Escalation: Anomalous Service Account Impersonator for Data Access | Medium |
| Secret reads | Data Access logs (DATA_READ) | AccessSecretVersion from a new identity | Medium. Off by default |
| Logging tampered with | Admin Activity logs | DeleteSink, UpdateSink, audit configuration removed through SetIamPolicy | Low. Alert on every one |
| Canary touched | Audit Logs, routed through a sink | Any read of a canary secret or object, or use of a canary service account | Very low. Nothing legitimate uses it |
Admin Activity logs are always on, so grants, new keys and sink changes are visible from day one. Reads are the blind spot. Listing secrets and reading their metadata is ADMIN_READ, reading a value is DATA_READ, and both are off by default outside BigQuery. Enable them at the organization or folder level and every project underneath inherits the setting.
Building the canary signal in Google Cloud: the three pieces
Google Cloud writes Cloud Audit Log entries for activity across a project, and a Log Router sink is what determines where those entries go: a Pub/Sub topic, BigQuery, Cloud Storage, or another destination, filtered down to the specific log entries a sink is configured to match. For a canary, that filter targets the exact resource and method the decoy cares about, like an AccessSecretVersion call against a specific Secret Manager secret, which is the method that returns the value. GetSecretVersion only returns metadata. From the Pub/Sub topic, an Eventarc trigger or a Pub/Sub-triggered Cloud Function is what turns a matching log entry into an actual notification, whether that's a Slack message, a PagerDuty page, or a simple email.
The audit log category that determines whether any of this works
Cloud Audit Logs split into a few categories, and knowing which one a canary depends on is the single most important detail in getting this right. Admin Activity logs, which cover configuration changes to a resource, are always on and can't be disabled. Data Access logs, which cover both reads of resource data and read-only API calls, are off by default for nearly every Google Cloud service, with BigQuery as the one notable exception, because of the sheer log volume reading operations generate at scale. A decoy Secret Manager secret or a decoy Cloud Storage object, built expecting a read to trigger an alert, will never fire unless Data Access logs have been explicitly enabled for that specific service. This is functionally the same trap as AWS's management-versus-data-event split and Azure's control-plane-versus-data-plane split: the category of log that's on by default almost never covers the kind of read a canary is actually built to catch.
Why project-by-project coverage tends to fall behind
A Log Router sink is scoped to a single project unless it's deliberately configured as an aggregated sink at the folder or organization level, pulling in matching logs from every project underneath. Most hand-built GCP canary setups start at the project level, because that's the fastest way to get one working, and stay there. An organization running dozens or hundreds of GCP projects, with new ones spinning up regularly, ends up with canary coverage that reflects whichever projects someone happened to configure first rather than the environment as it actually exists today. Tracebit's automated, organization-wide deployment is what keeps that coverage matched to the real project inventory instead of a snapshot from whenever the canaries were first set up. On AWS, the security team at Docker, whose containerization platform is used by millions of developers, describes deployment as integrating "effortlessly into our existing infrastructure, deployment pipelines, and SIEM systems," and the same code-based motion is what extends coverage to each new GCP project.
The bottom line on detecting an attacker in Google Cloud
Detecting an attacker in Google Cloud combines Event Threat Detection findings, always-on Admin Activity logs, and canaries for the reads nothing legitimate makes. Two details decide whether the canary layer works: Data Access logging has to be on, since it is off by default everywhere except BigQuery, and sink coverage has to keep pace with a project inventory that is constantly changing.
Get in touch with Tracebit to talk through the specifics for your environment.
More on tracebit.comDetect breaches across your GCP environmentFrequently asked questions about detecting an attacker in Google Cloud
- Why would a canary on a GCP resource not fire when it gets read?
- Almost certainly because Data Access audit logs aren't enabled for that service. Google Cloud logs Admin Activity (configuration changes) by default and can't turn it off, but Data Access logs, which cover reads of resource data like a Cloud Storage object or a Secret Manager secret's value, are off by default for every service except BigQuery. A canary depending on a read being logged needs those logs explicitly enabled first.
- What actually delivers the alert once a Log Router sink catches the event?
- A sink routes matching log entries to a destination — most commonly a Pub/Sub topic — and something needs to subscribe to that topic to act on it. An Eventarc trigger or a Pub/Sub-triggered Cloud Function is the typical way to turn that into a Slack message, a PagerDuty page, or an email.
- Does this catch a compromised service account the same way it catches a human attacker?
- Yes. Cloud Audit Logs record the identity making the call, whether that's a human, a service account, or a compromised piece of automation running with a service account's permissions, and the canary doesn't need to know which one it's dealing with to catch the touch.
- Is a single Log Router sink enough to cover an entire GCP organization?
- A sink is scoped to a project by default, though it's possible to configure an aggregated sink at the folder or organization level that captures matching logs across every project underneath it. Relying on per-project sinks set up individually is a common way coverage ends up inconsistent as new projects get created.
- Is Security Command Center enough to detect an attacker in Google Cloud?
- Event Threat Detection covers leaked keys, anomalous grants, impersonation and other known behaviour, and availability varies by Security Command Center tier. Its findings about reads depend on Data Access logs being on. Canary resources add a signal that fires on a single read, once that logging is enabled for the service the canary lives in.