Skip to content
Access control Write-up Advanced

CodeBreach: Infiltrating the AWS Console Supply Chain and Hijacking AWS GitHub Repositories via CodeBuild

A misconfigured regex filter in AWS CodeBuild pipelines for several AWS GitHub repositories allowed an attacker to bypass the actor ID allow-list by registering a GitHub user ID that contained an approved ID as a substring. This enabled the attacker to trigger a privileged build, steal a GitHub token with admin rights, and potentially inject malicious code into the AWS JavaScript SDK, risking a supply chain compromise.

Yuval Avrahami Follow

Published on wiz.io

Wiz Research uncovered CodeBreach, a critical vulnerability that placed the AWS Console supply chain at risk. The issue allowed a complete takeover of key AWS GitHub repositories - most notably the AWS JavaScript SDK, a core library that powers the AWS Console.

Yuval Avrahami, on wiz.io

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

The webhook filter used an unanchored regular expression, so any GitHub user ID containing an approved ID as a substring would pass the filter.

Impact

Attackers could have taken over the AWS JavaScript SDK repository and injected malicious code into releases, potentially compromising the AWS Console and many other applications; the same bypass affected at least three other AWS repositories, though AWS found no evidence of exploitation.

What the attacker needed

Public CodeBuild project with unanchored ACTOR_ID filter; ability to create GitHub accounts or apps; timing to claim a specific GitHub user ID

The fix

AWS anchored the vulnerable regex filters and revoked the exposed token, and later added a pull request comment approval gate and memory protections.

How it was found

  1. Find public CodeBuild projects and inspect their webhook filters.
  2. Identify that the ACTOR_ID filter uses an unanchored regex with pipe-separated IDs.
  3. Predict when a new GitHub user ID containing a target maintainer ID will become available.
  4. Use the GitHub App manifest flow to create many bot users simultaneously and claim the desired ID.
  5. Open a pull request from the new bot user to trigger a build.
  6. Extract the GitHub token from the build environment's memory and use it to gain admin access to the repository.

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.

A company's build system (CodeBuild) was set to run code from pull requests only if the person was on an approved list. But the check used a pattern match that only looked for the approved ID anywhere inside the new user's ID, not as an exact match. So an attacker could create a new GitHub account whose ID happened to contain an approved ID, and the build would run their code, letting them steal a powerful password (token) and take over the code repository.

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 Yuval Avrahami

View all

8 more disclosed reports, best first.

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.