Google Cloud Storage buckets leak in two ways: someone grants access to allUsers, or a credential that can read the bucket escapes into code, an image or a laptop. Google has added controls for both: uniform bucket-level access removes the second permission system (ACLs), public access prevention overrides public grants, organisation policy constraints can forbid HMAC keys, and retention policies and soft delete stop data being destroyed. None of these are complete by default on an older estate. This guide covers how access to Cloud Storage works, which roles are privileged, how service accounts, HMAC keys and signed URLs should be handled, what Cloud Audit Logs does and does not record, and a hardening baseline with rollout steps. It is for Google Cloud platform and security teams. For incident handling when a bucket is already exposed, use the Cloud Storage Exposure Playbook.
This is an independent guide from NHI Mgmt Group, based on Google Cloud's public documentation as of November 2026. It is not sponsored or reviewed by Google Cloud. Product features change, so confirm settings against Google Cloud's current documentation.
Key takeaways
- Enforce public access prevention at organisation level. The
storage.publicAccessPreventionconstraint overrides any IAM or ACL grant toallUsersandallAuthenticatedUsers, for new and existing buckets. - Turn on uniform bucket-level access, then keep it. It disables ACLs so IAM is the only access path; after 90 consecutive days it cannot be switched off, which is what you want.
- HMAC keys are long-lived static secrets. Block them with
storage.restrictAuthTypesunless an S3-compatible tool genuinely needs the XML API, and never use user-account HMAC keys. - Data Access logs are off by default. Without them you cannot see who read or deleted objects, and access to public objects is never logged at all.
- Retention and soft delete are your ransomware defence. Soft delete keeps deleted objects for 7 days by default (up to 90); a locked retention policy blocks deletion entirely until objects age out.
How identity and access work in Google Cloud Storage
Cloud Storage authorises requests through Identity and Access Management (IAM) policies set on the organisation, folder, project, bucket or managed folder. Historically it also supported Access Control Lists (ACLs) on buckets and individual objects, which created a second, object-level permission system that was hard to audit.
- Principals: Google accounts, groups, service accounts, Workforce and Workload Identity Federation identities, and the special principals
allUsers(anyone on the internet) andallAuthenticatedUsers(anyone with a Google account, not just your organisation). - Uniform bucket-level access (UBLA): disables ACLs; requests to set or read ACLs return
400 Bad Request. Google stores existing ACLs and restores them if UBLA is disabled within the first 90 days. UBLA is required for managed folders, hierarchical namespace buckets, IAM Conditions on the bucket and granting access to federated identities. - Public access prevention (PAP): a bucket is either enforced or inherited (follows the organisation policy). When it applies, requests authorised through
allUsersorallAuthenticatedUsersfail with 401 or 403, and attempts to add those principals fail with412 Precondition Failed. Existing public grants stay in the policy but are overridden; disabling PAP makes them live again. - Signed URLs: time-limited URLs signed by a service account, which grant access to one object without an IAM grant. PAP does not block them, so they are the sanctioned way to share an object outside the organisation. V4 signed URLs can be valid for at most 7 days.
- HMAC keys: an access ID and secret used to sign requests to the XML API (the S3-compatible interface). They are separate from service account RSA keys and cannot mint OAuth tokens.
- Network controls: VPC Service Controls perimeters and bucket IP filtering restrict where requests can come from, independently of IAM. See the VPC Service Controls Guide.
| Control | Scope | Reversible? | What it stops |
|---|---|---|---|
| Uniform bucket-level access | Bucket; required by storage.uniformBucketLevelAccess for new buckets | Only within 90 consecutive days | Hidden object-level ACL grants |
| Public access prevention | Bucket, or project/folder/organisation via storage.publicAccessPrevention | Yes (old public grants return) | Access via allUsers and allAuthenticatedUsers |
storage.restrictAuthTypes | Organisation, folder or project | Yes | Requests signed with HMAC keys (and optionally RSA-signed requests) |
| Bucket IP filtering | Bucket | Yes | Requests from outside listed CIDR ranges and VPC networks |
| VPC Service Controls | Perimeter around projects | Yes | Copying data to projects outside the perimeter |
| Locked retention policy (Bucket Lock) | Bucket | No, locking is irreversible | Deletion or overwrite before the retention period ends |
| Soft delete | Bucket; allowed durations via storage.softDeletePolicySeconds | Yes (set duration to 0) | Permanent loss from deletion for 7 to 90 days |
Admin roles and privileged access
The roles that matter most are the ones that can change who has access, because they can make a bucket public (where PAP is not enforced) or grant an outside identity read access. Google documents that only roles/storage.admin and roles/storage.legacyBucketOwner among the Cloud Storage roles include storage.buckets.setIamPolicy. Project-level basic roles (Owner, Editor) also carry broad storage permissions. See the Google Cloud IAM and Service Accounts Guide.
| Role | What it allows | Guidance |
|---|---|---|
roles/storage.admin | Full control of buckets and objects, including IAM policy | Platform team only, through just-in-time access; never for applications |
roles/storage.legacyBucketOwner | Edit bucket metadata and policies, mirrored in ACLs | Remove after moving to UBLA |
roles/storage.objectAdmin | List, create, read, overwrite and delete objects | Only for workloads that manage data lifecycles |
roles/storage.objectUser | Create, read, update and delete objects | Typical application role; scope to one bucket or managed folder |
roles/storage.objectCreator | Add objects without reading, deleting or overwriting | Ideal for log shippers and backup writers |
roles/storage.objectViewer | Read and list objects | Read-only consumers; the role most often granted to allUsers by mistake |
roles/storage.hmacKeyAdmin | Create, update and delete HMAC keys in the project | Rarely needed; alert on every assignment. Note that roles/storage.admin does not include HMAC key permissions |
| Owner, Editor (basic roles) | Broad permissions across the project, including storage | Remove from humans and service accounts in data projects |
- Grant at the bucket, not the project: a project-level objectViewer grant reaches every bucket in the project, including ones created later.
- Use managed folders for shared buckets: they allow IAM grants on a prefix without per-object ACLs (UBLA required).
- Protect organisation policy administrators: anyone with
roles/orgpolicy.policyAdmincan relax PAP or UBLA enforcement for a whole organisation. See the Google Cloud Organization Policy Guide.
Integrations, API tokens and service accounts
Most bucket access is non-human: applications, data pipelines, backup tools, CI jobs and analytics services. The credential choices below decide how bad a leak can be.
| Credential | Lifetime | Risk | Preferred alternative |
|---|---|---|---|
| Attached service account (metadata server) | Short-lived tokens | Low, if the role is narrow | Default choice on Google Cloud compute |
| Workload Identity Federation | Short-lived tokens from an external identity provider | Low | Default for CI/CD and workloads in other clouds |
| Service account key (JSON) | Until deleted | High: portable, often copied into images and repositories | Federation or attached service accounts. See the Google Cloud Service Account Keys Security Guide |
| Service account HMAC key | Until deactivated or deleted | High: static secret, works from anywhere unless network controls apply | JSON API with OAuth; restrict with storage.restrictAuthTypes |
| User account HMAC key | Tied to a person | Very high: Google notes secrets can be viewed in the Interoperability tab by anyone with resourcemanager.projects.get in a project the user can access | Deny USER_ACCOUNT_HMAC_SIGNED_REQUESTS everywhere |
| Signed URL | Up to 7 days (V4) | Medium: anyone holding the URL can use it until expiry | Short expiry, single object, generated on demand |
- HMAC key hygiene where unavoidable: service account keys only, at most 10 per service account, secret stored in Secret Manager (it is shown only once), rotated by creating the new key, deploying it, then deleting the old one. Use the
storage.googleapis.com/authn/authentication_countmetric filtered byaccess_idto confirm an old key is unused before deletion. - One service account per workload and bucket set: shared "storage-sa" accounts with objectAdmin across projects turn one leak into an estate-wide incident.
- Keep credentials out of build artefacts: a credential inside a container image or build output is readable by anyone who can pull it, so inject Cloud Storage credentials at run time instead of baking them in.
- Write-only for writers: log shippers and backup jobs should hold
roles/storage.objectCreator, so a stolen credential cannot read or delete history.
Logging and detection
Cloud Audit Logs for Cloud Storage has three relevant streams. Admin Activity logs are always on and cannot be disabled: they record IAM policy changes, bucket creation and deletion, bucket metadata updates and HMAC key creation, update and deletion. Data Access logs are off by default and split into ADMIN_READ (bucket metadata, listing buckets, listing HMAC keys), DATA_READ (reading and listing objects) and DATA_WRITE (creating, deleting, restoring objects). System Event logs record Google-initiated operations.
- Enable Data Access logs on sensitive buckets: at least DATA_WRITE everywhere (deletions) and DATA_READ on buckets holding regulated or secret data. Budget for the volume.
- Know the gaps: Google states that access to public objects is not logged and changes by Object Lifecycle Management or Autoclass are not tracked. Public exposure has to be prevented, because it cannot be investigated afterwards.
- Restrict log readers: reading Data Access logs requires Private Logs Viewer, not Logs Viewer. Route logs to a separate logging project with a locked bucket. See the Google Cloud Audit Logs and Log Sinks Guide.
| Detection | Log or signal | ATT&CK |
|---|---|---|
IAM policy change adding allUsers or allAuthenticatedUsers (even if PAP overrides it) | Admin Activity storage.setIamPermissions | T1530 |
| PAP set from enforced to inherited, UBLA disabled, retention policy removed | Admin Activity bucket update | T1530 |
HMAC key created, or roles/storage.hmacKeyAdmin granted | Admin Activity | T1552.001 |
| Bulk listing followed by mass reads from a new identity or IP | Data Access DATA_READ, storage.objects.list | T1619, T1530 |
| Copying objects to a bucket in another project or organisation | Data Access, VPC Service Controls violations | T1537 |
| Mass deletion or soft delete duration set to 0 | Data Access DATA_WRITE, Admin Activity | T1485 |
Metrics
- Percentage of buckets with PAP enforced or inherited from an enforced organisation policy (target 100%, with listed exceptions).
- Percentage of buckets with UBLA enabled.
- Number of active HMAC keys, and number older than 90 days.
- Number of service account keys with storage access.
- Percentage of sensitive buckets with Data Access logs and a retention policy.
Hardening baseline
| Area | Setting | Enforce with |
|---|---|---|
| Public exposure | PAP enforced organisation-wide; public websites served from a dedicated project with documented exceptions, or through Cloud CDN with private bucket access | constraints/storage.publicAccessPrevention |
| Single permission model | UBLA on every bucket | constraints/storage.uniformBucketLevelAccess |
| Static credentials | Deny in:ALL_HMAC_SIGNED_REQUESTS, or at minimum USER_ACCOUNT_HMAC_SIGNED_REQUESTS | constraints/storage.restrictAuthTypes |
| Transport | No plain HTTP; TLS 1.2 or later | constraints/storage.secureHttpTransport, constraints/gcp.restrictTLSVersion |
| Encryption keys | Customer-managed encryption keys (CMEK) for regulated data, from approved key projects | constraints/gcp.restrictNonCmekServices, constraints/gcp.restrictCmekCryptoKeyProjects. See the Cloud KMS and Cloud HSM Guide |
| Recoverability | Soft delete at least 7 days, longer for critical data; Object Versioning where overwrite is a risk | constraints/storage.softDeletePolicySeconds |
| Immutability | Retention policy locked on backup and evidence buckets (maximum 100 years); event-based holds for litigation | constraints/storage.retentionPolicySeconds |
| Audit | Data Access logs on sensitive buckets; detailed audit logging mode where regulation requires | Audit config at organisation level; constraints/gcp.detailedAuditLoggingMode |
| Network | VPC Service Controls for data projects; bucket IP filtering for buckets used from known networks | Access Context Manager, bucket configuration |
Rollout
- Inventory: list all buckets with their IAM policies, PAP and UBLA state, retention and soft delete settings, and HMAC keys. Security Command Center findings and Cloud Asset Inventory help at scale.
- Find ACL dependence: check the
storage.googleapis.com/authz/acl_operations_countmetric; a non-zeroOBJECT_ACCESS_REQUIRED_OBJECT_ACLcount means some access still relies on object ACLs. Replace those with IAM or managed folder grants first. - Enable UBLA bucket by bucket: you have 90 days to roll back if something breaks; after that the setting is permanent.
- Enforce PAP: set the organisation constraint, with project-level exceptions for genuinely public content. Changes take up to 10 minutes, and copies may persist in internet caches for their Cache-Control max-age.
- Replace HMAC keys: migrate tools to the JSON API or to service account HMAC keys, watch
authentication_count, then applystorage.restrictAuthTypes. Existing keys stop working but can still be deactivated and deleted. - Lock retention last: test retention on a non-locked bucket first. Locking is irreversible, places a lien on the project, and the bucket cannot be deleted until every object has met the retention period.
Small team or large estate
- Small team: set the PAP and UBLA constraints at organisation level on day one, use attached service accounts, keep soft delete on, and enable DATA_WRITE logging. That covers most real exposures.
- Large estate: layer VPC Service Controls around data projects, standardise bucket creation through infrastructure as code modules, review HMAC and service account keys monthly, and map buckets to data classification so logging and CMEK follow sensitivity. The Google Cloud Enterprise Foundations Blueprint Guide describes the organisation structure these controls assume.
Common misconfigurations
allAuthenticatedUserstreated as "internal": it means any Google account holder in the world.- PAP inherited from an organisation policy that was never set: "inherited" with no constraint means no protection.
- Fine-grained ACLs left on old buckets: one public object ACL on a bucket that looks private in IAM.
- User-account HMAC keys from early S3 migrations: tied to a person, readable by others in the project and forgotten when they leave.
- Soft delete set to 0 to save cost on a bucket that holds backups: one mass deletion becomes permanent.
- Relying on audit logs to scope a public exposure: public object reads are not logged, so the honest answer to "what was accessed?" is "unknown".
Framework mapping
| Control area | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | MITRE ATT&CK addressed |
|---|---|---|---|
| IAM, UBLA, PAP | AC-3, AC-6 | PR.AA-05 | T1530, T1619 |
| HMAC and service account key restriction | AC-6 | PR.AA-05 | T1552.001, T1078.004 |
| Encryption and TLS | SC-28, SC-8 | PR.DS-01 | T1530 |
| Retention, soft delete, Bucket Lock | SI-12 | PR.DS-01 | T1485 |
| Audit logging | AU-2 | DE.CM-09 | T1537 |
| Organisation policy constraints | AC-3 | PR.PS-01 | All of the above |
Practitioner checklist
- Set
storage.publicAccessPreventionandstorage.uniformBucketLevelAccessto enforced at organisation level, with recorded exceptions. - Remove every
allUsersandallAuthenticatedUsersgrant, even where PAP currently overrides it. - Deny user-account HMAC signed requests everywhere and inventory service account HMAC keys.
- Replace service account JSON keys with attached service accounts or Workload Identity Federation.
- Grant storage roles at bucket or managed folder level; use objectCreator for writers.
- Enable Data Access logs (DATA_WRITE everywhere, DATA_READ on sensitive buckets) into a separate logging project.
- Alert on IAM changes to buckets, PAP and UBLA changes, HMAC key creation and soft delete set to 0.
- Lock retention policies on backup and evidence buckets after testing.
- Put data projects inside a VPC Service Controls perimeter.
Standards and references
- Google Cloud: Uniform bucket-level access
- Google Cloud: Public access prevention
- Google Cloud: Organization policy constraints for Cloud Storage
- Google Cloud: HMAC keys
- Google Cloud: Cloud Audit Logs with Cloud Storage
- Google Cloud: IAM roles for Cloud Storage
- Google Cloud: Bucket Lock
- Google Cloud: Soft delete
Related NHI Mgmt Group resources: Cloud Storage Exposure Playbook · Google Cloud Security Guide · T1530 Data from Cloud Storage Defensive Guide · Google Cloud Service Account Keys Security Guide