Skip to content
Access control Write-up Advanced

Bad.Build: A Critical Privilege Escalation Design Flaw in Google Cloud Build Enables a Supply Chain Attack

A design flaw in Google Cloud Build allowed anyone with the cloudbuild.builds.create permission to impersonate the default Cloud Build service account and access the project's full IAM policy via audit logs. This enabled attackers to escalate privileges, access Artifact Registry, and tamper with container images, potentially leading to a supply chain attack.

Roi Nisimi Follow

Published on orca.security

Bad.Build is a critical design flaw discovered by the Orca Research Pod in the Google Cloud Build service that enables attackers to escalate privileges and gain unauthorized access to code repositories and images in Artifact Registry.

Roi Nisimi, on orca.security

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the default Cloud Build service account was granted excessive permissions, including the ability to read audit logs that contained the full project IAM policy, and any user with cloudbuild.builds.create could indirectly use those permissions.

What the attacker needed

Cloudbuild.builds.create permission; access to a GCS bucket for build logs; target project uses Artifact Registry

The fix

Google partially fixed the issue by revoking the logging.privateLogEntries.list permission from the default Cloud Build service account, but the privilege escalation vector remains, so organisations should apply least privilege and monitor the service account's behaviour.

How it was found

  1. Obtain the cloudbuild.builds.create permission via a role such as Dataflow Developer.
  2. Submit a Cloud Build job that runs a gcloud command to read audit logs for setIamPolicy events.
  3. Extract the full project permission bindings from the audit log entry.
  4. Use the Cloud Build service account to list Artifact Registry repositories and Docker images.
  5. Pull a target image, inject malicious code, and push it back to the registry.
  6. Deploy the tampered image to GKE, enabling remote code execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Google Cloud Build is a service that automatically builds and deploys software. A design flaw meant that a user with a common permission could make Cloud Build run commands as its powerful default service account, which had broad access. This let an attacker see all permissions in the project and then modify container images stored in Google's registry, potentially infecting software used by customers.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Roi Nisimi

View all

3 more disclosed reports, best first.

More from Google

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.