Strobesstrobes
Platform
Solutions
Resources
Customers
Company
Pricing
Book a Demo
Strobesstrobes

Strobes connects every exposure signal to autonomous action, so security teams fix what matters, prove what works, and stop chasing noise.

Book a DemoTalk to an expert
ISO 27001SOC 2CREST
  • Platform
  • Platform Overview
  • Agentic Exposure Management
  • AI Agents
  • Integrations
  • API & Developers
  • Workflows & Automation
  • Analytics & Reporting
  • Solutions
  • Exposure Assessment (EAP)
  • Attack Surface Management
  • Application Security Posture
  • Risk-Based Vulnerability Management
  • Adversarial Exposure Validation (AEV)
  • AI Pentesting
  • Pentesting as a Service
  • CTEM Framework
  • By Industry
  • Financial Institutions
  • Technology
  • Retail
  • Healthcare
  • Manufacturing
  • By Roles
  • CISOs
  • Security Directors
  • Cloud Security Leaders
  • App Sec Leaders
  • Resources
  • Blog
  • Customer Stories
  • eBooks
  • Datasheets
  • Videos & Demos
  • Exposure Management Academy
  • CTEM Maturity Assessment
  • Pentest Health Check
  • Security Tool ROI Calculator
  • Company
  • About Strobes
  • Meet the Team
  • Trust & Security
  • Contact Us
  • Careers
  • Become a Partner
  • Technology Partner
  • Partner Deal Registration
  • Press Release

Weekly insight for security leaders

CTEM research, agentic AI trends, and what's actually moving the needle.

© 2026 Strobes Security Inc. All rights reserved.

Privacy PolicyTerms of ServiceCookie PolicyAccessibilitySitemap
Back to Blog
GCP Penetration Testing Guide
Cloud pentestingCloud Security

GCP Penetration Testing Guide

Shubham JhaJuly 24, 20258 min read

Table of Contents

  • What are the rules for penetration testing GCP?
  • How does GCP IAM enable privilege escalation?
  • Why are service account keys so dangerous?
  • How does the GCP metadata server SSRF pivot work?
  • What tools should you use for GCP penetration testing?
  • Frequently asked questions
  • Sources and references

Authors

S
Shubham Jha

Share

Table of Contents

  • What are the rules for penetration testing GCP?
  • How does GCP IAM enable privilege escalation?
  • Why are service account keys so dangerous?
  • How does the GCP metadata server SSRF pivot work?
  • What tools should you use for GCP penetration testing?
  • Frequently asked questions
  • Sources and references

Authors

S
Shubham Jha

Share

TL;DR
  • ✓Google does not require notification to penetration test your own GCP projects, but you must comply with the Google Cloud Acceptable Use Policy, which still forbids disruptive testing like DoS.
  • ✓GCP IAM is the core target: project, folder, and organization-level role bindings, plus service accounts whose keys and impersonation permissions enable privilege escalation.
  • ✓Service account keys are long-lived JSON credentials. When they leak into repos, images, or metadata, they grant whatever the service account can do until manually revoked.
  • ✓The GCP metadata server at metadata.google.internal (169.254.169.254) returns service account tokens, and it requires the Metadata-Flavor: Google header, which blocks header-less SSRF.
  • ✓ScoutSuite, Prowler, and the GCP IAM privilege-escalation research from Rhino Security map the posture and the escalation paths.

GCP penetration testing lives and dies on IAM. Google lets you test your own projects without prior approval as long as you follow the Google Cloud Acceptable Use Policy, so scoping is about what you target rather than a permission request. The defining feature of Google Cloud is its IAM model, where roles bind to identities at the project, folder, or organization level, and service accounts can impersonate one another. Get the binding graph wrong and a single leaked key escalates to project owner.

This guide covers Google's rules of engagement, the IAM and service-account-key attack paths, the metadata-server SSRF pivot, storage and OAuth scope risks, and the tooling that maps it. As always, written authorization from the project owner is assumed.

What are the rules for penetration testing GCP?

Google does not require you to notify or get approval to penetration test resources in your own GCP projects, but you must comply with the Google Cloud Platform Acceptable Use Policy and Terms of Service. You test the resources you own: Compute Engine instances, Cloud Functions, Cloud Storage buckets, GKE clusters, and your IAM configuration. You do not test Google's underlying infrastructure or other customers.

Prohibited activity follows the familiar pattern: no denial-of-service or any test that disrupts Google's services or other tenants, no testing of resources you do not own, and nothing that violates the AUP. Because GCP testing is heavily identity-focused, it has more in common with reviewing access models than with a network sweep, and it pairs naturally with our overview of what to expect from a cloud penetration test.

GCP Testing: In Scope vs Out of Scope
In scope (no approval)Out of scope / prohibited
Your Compute, Cloud Functions, GKEGoogle's underlying infrastructure
Your Cloud Storage bucket configDoS or service-disrupting tests
Your IAM bindings and service accountsTesting resources you do not own
App-layer attacks on your own appsAnything violating the GCP AUP
Custom-role permission reviewOther tenants' projects or data

How does GCP IAM enable privilege escalation?

GCP IAM escalation comes from permissions that let an identity grant itself more access or act as a more privileged identity. Rhino Security Labs documented around two dozen escalation methods, and the patterns are consistent: iam.serviceAccounts.getAccessToken or iam.serviceAccounts.actAs let you impersonate a more privileged service account; iam.serviceAccountKeys.create lets you mint a new key for a privileged account; and setIamPolicy permissions on a project, bucket, or function let you bind yourself a stronger role.

Deploy-style permissions are equally dangerous. cloudfunctions.functions.create plus actAs, or compute.instances.create with the ability to attach a privileged service account, let you run code as that account. Enumerate effective permissions, then walk the binding graph at project, folder, and org levels. Do not trust role names; check the actual permissions a custom role grants.

  • Look for the default Compute Engine service account, which often holds the broad Editor role.
  • Flag any user or service account with roles/owner or setIamPolicy.
  • Check for service accounts you can impersonate via actAs.

Why are service account keys so dangerous?

Service account keys are long-lived JSON credential files, and unlike short-lived metadata tokens they do not expire on their own. When a key leaks into a public repo, a container image, a CI variable, or instance metadata, whoever finds it can authenticate as that service account and use every permission it holds until an administrator manually disables or deletes the key.

During a test, hunt keys everywhere: source control, build artifacts, environment variables, and the metadata of compromised instances. Once you have a key, run gcloud auth activate-service-account , key-file=key.json and enumerate what it can do. The defensive position is to avoid user-managed keys entirely in favor of workload identity and short-lived tokens, then alert on any key creation. Secrets hygiene here mirrors the leaked-credential problem across cloud, which we also cover in the Azure penetration testing guide.

How does the GCP metadata server SSRF pivot work?

The GCP metadata server returns OAuth access tokens for the instance's attached service account, making it a prime SSRF target. From a compromised instance or via SSRF, request http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token with the header Metadata-Flavor: Google. The response is an access token scoped to whatever OAuth scopes the instance was launched with.

That required Metadata-Flavor: Google header is the key defense. Legacy /v1beta1/ endpoints did not require it, but those are deprecated; the v1 endpoint rejects requests without the header, so SSRF primitives that cannot set custom headers fail. The other limiting factor is OAuth scopes: an instance launched with restricted scopes yields a token that cannot do much even if the service account has broad IAM roles. Check both the scopes and the underlying roles. The mechanics echo the metadata attacks in our AWS penetration testing guide.

Strobes insight
On GCP, a metadata token is gated by OAuth scopes, not just IAM roles. An instance with broad service-account roles but restricted launch scopes hands you a near-useless token. Always check both before rating the SSRF finding.

What tools should you use for GCP penetration testing?

Posture first, then exploitation. ScoutSuite and Prowler both support GCP and surface public buckets, over-permissive bindings, default service accounts with Editor, and disabled logging. Cartography ingests GCP assets into a graph for relationship queries across projects. The native gcloud CLI is your enumeration workhorse: gcloud projects get-iam-policy, gcloud iam service-accounts list, and recursive ancestry checks.

For escalation, use the Rhino Security GCP IAM Privilege Escalation scripts to test the documented methods against discovered identities, and GCPBucketBrute to enumerate and check Cloud Storage buckets for misconfigured access. Methodology: enumerate projects and IAM, map the binding graph, hunt service-account keys, pivot through metadata tokens, then check storage and OAuth scope exposure. Running this on a cadence rather than once a year is the case for continuous, agentic pentesting, and findings feed straight into a cloud security posture checklist.

Frequently asked questions

Do you need Google's permission to pentest GCP?
No advance notification or approval is required to test resources you own in your own GCP projects, but you must comply with the Google Cloud Acceptable Use Policy and Terms of Service. Those still prohibit denial-of-service testing, disrupting Google's services, and testing resources or tenants you do not own.
How do attackers escalate privileges in GCP IAM?
Common paths use permissions like iam.serviceAccounts.actAs and getAccessToken to impersonate privileged service accounts, iam.serviceAccountKeys.create to mint new keys, and setIamPolicy to bind a stronger role to yourself. Deploy permissions on Cloud Functions or Compute combined with actAs also let you run code as a privileged account.
Why are GCP service account keys risky?
Service account keys are long-lived JSON credentials that do not expire automatically. If one leaks into a repository, image, CI variable, or instance metadata, an attacker can authenticate as that service account and use all its permissions until an administrator manually revokes the key. Workload identity and short-lived tokens are the safer alternative.
How does SSRF to the GCP metadata server work?
A request to http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token with the Metadata-Flavor: Google header returns an OAuth access token for the instance's service account. The required header blocks SSRF primitives that cannot set custom headers, and the token's power is limited by the instance's OAuth scopes.
What tools are used for GCP penetration testing?
ScoutSuite and Prowler cover misconfiguration posture, Cartography graphs asset relationships, GCPBucketBrute enumerates storage buckets, and the Rhino Security GCP IAM privilege-escalation scripts test documented escalation methods. The native gcloud CLI handles most enumeration of projects, IAM policies, and service accounts.
What is the most common GCP misconfiguration?
Over-privileged default service accounts are the most common issue, particularly the default Compute Engine service account which often carries the broad Editor role. Combined with instances launched using full-access OAuth scopes, this lets a single compromised instance act with wide project permissions.

Sources and references

  • Google Cloud Acceptable Use Policy
  • GCP Storing and Retrieving Instance Metadata
  • Rhino Security GCP IAM Privilege Escalation
  • ScoutSuite
S
Shubham Jha
Security Researcher, Strobes
Shubham Jha leads offensive security research at Strobes, focused on web and API exploitation and red team tradecraft.
Tags
Cloud PentestingGCPCloud Security

Stop chasing vulnerabilities Start reducing exposure

See how Strobes AI agents validate and fix your most critical exposures automatically.

Book a Demo
Continue Reading

Related Posts

Beyond the Basics Developing a Risk Driven AI Driven Cloud Native Security Strategy.
Cloud Security

Beyond the Basics Developing a Risk Driven AI Driven Cloud Native Security Strategy.

The use of clouds has taken a significant step forward beyond workloads and virtual machines. Containers, Kubernetes, microservices, APIs, and serverless functions can be relied upon by modern enterprises to provide a cloud-native architecture. Such environments not only speed up the delivery of sof

Oct 22, 202512 min
Beyond the Basics Developing a Risk Driven AI Driven Cloud Native Security Strategy
Cloud Security

Beyond the Basics Developing a Risk Driven AI Driven Cloud Native Security Strategy

Cloud-native architectures bring speed and scalability but also create new risks beyond traditional workloads. Misconfigured APIs, vulnerable containers, and over-permissive access expose enterprises to advanced threats. This blog explains why legacy security tools fall short, how AI-driven strategi

Sep 30, 202512 min
Rethinking Cloud Security in Healthcare: Balancing Compliance Risk and ROI
Cloud Security

Rethinking Cloud Security in Healthcare: Balancing Compliance Risk and ROI

Cloud technology is transforming healthcare by powering EHRs, telemedicine, and scalable patient services. But with benefits come risks, misconfigurations, shadow IT, and third-party exposures drive multimillion-dollar breaches. With the healthcare cloud market set to triple by 2032, balancing compl

Sep 10, 202511 min