Supply Chain Attack on Chromium-BiDi and Puppeteer via GitHub Cache Poisoning
A GitHub Actions workflow in the chromium-bidi repository published an artifact that leaked the cache URL and runtime token, letting anyone write poisoned entries into the repository's action cache. A poisoned cache entry was then consumed by another workflow, allowing theft of a bot token with write access to chromium-bidi, webdriver-bidi-protocol and puppeteer, which could enable publishing a malicious npm package.
Published on issues.chromium.org
SecurityImpact-Noneexternalsecurityreportreward-ineligible
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.
Context
This report concerns the GitHub Actions workflows of the GoogleChromeLabs/chromium-bidi repository, specifically .github/workflows/wpt.yml. The workflow produces an artifact called mapper-headless-artifacts.zip. The report describes a supply chain attack in which that artifact leaks two environment variables that are enough to poison the GitHub Actions cache on the main branch, and from there to steal a secret used by a later workflow.
The report was filed through the Google/OSS VRP and was copied into the Chromium tracker from b/355237064. The reporter states plainly that they did not reproduce the vulnerability, because proof was already provided in commit [redacted].
Setup
No accounts, roles or tool versions are described. The only preconditions the report names are:
- The
wpt.ymlworkflow runs and publishesmapper-headless-artifacts.zip. - A later workflow,
update-bidi-types.yml, consumes cache entries onmain. - The attacker has a GitHub account able to run their own GitHub Action, which the exploit does every 5 minutes.
The exploit itself is attached to the report as chrome-bidi-exploit-master.zip, and the workflow log that created the malicious cache entry is attached as exploit.log.
Finding it
The reporter downloaded the published artifact and searched it for the two variables that the GitHub Actions cache API needs. The commands are run at the root of the extracted archive:
grep -r ACTIONS_CACHE_URL | awk '{print $2 $3}' | sort -u
grep -r ACTIONS_RUNTIME_TOKEN | awk '{print $2 $3}' | sort -u
The result is that both ACTIONS_CACHE_URL and ACTIONS_RUNTIME_TOKEN are present in the artifact. The report notes that the ACTIONS_RUNTIME_TOKEN is valid for 7 hours and continues to work even after the workflow run that produced it has completed. That combination is what makes cache poisoning on main possible from outside the repository.
Exploitation
Step 1: Clone the target repository
The exploit runs on a schedule every 5 minutes through a GitHub Action. Its first action is to clone the latest version of GoogleChromeLabs/chromium-bidi.
Step 2: Force a new cache key
GitHub Actions cache entries cannot be overwritten, so the exploit bumps the minor version of package-lock.json. This generates a new cache key and version for chromium-bidi, which is necessary for the next step to create fresh entries rather than collide with existing ones.
Step 3: Create cache entries in the attacker's repository
The exploit runs npm ci, which the report says uses google/wire-it under the hood. This creates two cache entries in the repository running the exploit.
Step 4: Build a poisoned cache tarball
The exploit downloads the latest cache entry tarball produced in the previous step, decompresses it, and creates a new one that includes a malicious cddlconv at /home/runner/.local/bin/. That binary dumps all the GitHub Actions secrets in memory and exfiltrates them to a gist.
Step 5: Harvest the leaked credentials
The exploit downloads a vulnerable artifact from the main branch of GoogleChromeLabs/chromium-bidi and extracts ACTIONS_CACHE_URL and ACTIONS_RUNTIME_TOKEN from it, using the same leak described above.
Step 6: Upload the poisoned entry to main
With those two values, the exploit uploads the poisoned cache entry to the main branch of GoogleChromeLabs/chromium-bidi.
Delivery through update-bidi-types.yml
The poisoned cache entry is consumed by update-bidi-types.yml after a new version of chromium-bidi is released. The report says this happened on the day of filing: version 6.0.1 was released, and shortly afterwards the Send PR job of update-bidi-types.yml executed and consumed the following malicious cache entry:
{
"id": 75770,
"ref": "refs/heads/main",
"key": "[redacted]",
"version": "[redacted]",
"last_accessed_at": "2024-07-12T10:05:01.230000000Z",
"created_at": "2024-07-12T09:47:54.930000000Z",
"size_in_bytes": 446355
}
The entry is scoped to refs/heads/main.
What the stolen token can reach
The secret taken by the malicious cddlconv is BROWSER_AUTOMATION_BOT_TOKEN. The reporter enumerated the repositories accessible to it with:
curl -H "Authorization: token ghp_[REDACTED]" https://api.github.com/user/repos
The output is attached as enumeration.log. According to the report, the token grants push: write and pull: write access to:
- GoogleChromeLabs/chromium-bidi
- GoogleChromeLabs/webdriver-bidi-protocol
- puppeteer/puppeteer
Root cause
The workflow publishes an artifact that contains the runner's ACTIONS_CACHE_URL and ACTIONS_RUNTIME_TOKEN. Those values are the credentials for the GitHub Actions cache service, so anyone who can download the artifact can act on the repository's cache. The report does not describe which step of wpt.yml writes the variables into the artifact, only that they are present in it.
Two properties of the platform make the leak worse. Cache entries cannot be overwritten, which is why the exploit bumps the lockfile version to obtain a new key rather than replacing an existing entry. And the runtime token stays valid for 7 hours after the run finishes, so the window for abuse is much longer than the workflow itself.
The poisoned entry is only consumed when a new chromium-bidi version triggers update-bidi-types.yml, so the attacker has to wait for that event, but no interaction from the maintainers beyond a normal release is needed.
Impact
Anyone can exploit this, according to the report. With BROWSER_AUTOMATION_BOT_TOKEN, an attacker can write directly to any non-protected branch, approve and merge pull requests from forks (and so push content to protected branches), and create releases and tags. In the case of Puppeteer, the report says this could lead to publication of a malicious package in the npm registry, and notes that because releases can be created directly in the puppeteer repository, this would even work with the wombat-dressing-room 2FA protection.
The report does not state that any of this was carried out.
Fix
The issue is marked Fixed. The report itself contains no remediation guidance: the remediation section is empty. The commit referenced as proof is [redacted].
Variants to test
- Search other public workflow artifacts for
ACTIONS_CACHE_URLandACTIONS_RUNTIME_TOKENwith the samegrepcommands. A positive result is both variables appearing in the output, which means the cache on that repository's default branch can be poisoned. - Check whether a repository's release process consumes cache entries on
main(for example a workflow that runs after a version bump). A positive result is a workflow that restores a cache key scoped torefs/heads/mainwithout any validation of the entry's contents. - Look for workflows that execute binaries from cache-restored paths such as
/home/runner/.local/bin/. A positive result is a cache entry whose contents are executed by a later job, which is the delivery mechanism used here. - Test whether tokens found in artifacts remain valid after the run completes. A positive result is a token that still authenticates to the cache API hours later, extending the attack window beyond the workflow run.
What happened, in plain words
A security researcher found a way to sneak malicious code into Google's open-source browser automation projects. The trick was not a bug in the browser itself. It was a bug in the automated helper scripts that run on GitHub, the website where the source code lives.
Here is the story in everyday terms. Imagine a shared office kitchen with a fridge. Anyone in the building can put a labelled lunchbox in the fridge, and later a colleague picks up the box with that label and eats what is inside. Now imagine the fridge key is left lying on a table in the lobby. A stranger can walk in, take the key, put their own lunchbox in the fridge with the label a colleague is expecting, and wait. When the colleague opens the box, they eat whatever the stranger put there. In this report, the "fridge" is GitHub's cache, the "key" is a pair of secret values leaked inside a downloadable file, and the "colleague" is a later automated job that trusts whatever it finds in the cache.
The project affected is GoogleChromeLabs/chromium-bidi. Chromium is the open-source engine behind Google Chrome and many other browsers. BiDi (short for WebDriver BiDi) is a protocol, meaning a shared language, that lets test tools drive a browser: open pages, click things, read what is on screen. Puppeteer is a popular tool that developers use to automate Chrome. The report says this could lead to the publication of a malicious package in the npm registry. That is why this matters.
The report was filed through the Google/OSS VRP. OSS VRP is Google's reward programme for security bugs in open-source software. The report was then copied into the Chromium issue tracker from an internal bug numbered b/355237064. The reporter is honest about one thing: they did not reproduce the vulnerability themselves, because proof was already provided in a specific code change, commit [redacted].
The pieces you need to know
Before the steps make sense, here are the building blocks, explained from zero.
- GitHub is a website where software teams store code and collaborate. Each project is called a repository, or repo for short.
- GitHub Actions is GitHub's built-in robot worker. You write a recipe file (a workflow) that says "when X happens, run these commands on a fresh computer". GitHub then spins up a temporary machine, called a runner, and executes the recipe. These recipes live in a folder called
.github/workflows/inside the repo. - A workflow is one of those recipe files. The two that matter here are
wpt.ymlandupdate-bidi-types.yml. - An artifact is a file that a workflow produces and uploads so people can download it later, like a report or a build output. Here the artifact is called
mapper-headless-artifacts.zip. - A cache is a storage area where workflows keep things they will need again, so they do not have to rebuild them from scratch every time. Think of it as the office fridge: you label a box, put it in, and later fetch the box by its label. The label is called a cache key.
- An environment variable is a named value that a program can read while it runs, like a sticky note on the desk saying "the printer is in room 3". Workflows use them to pass settings and secrets to commands.
- A token is a long random string that acts like a temporary password. Whoever holds it can prove they are allowed to do something, without typing a username and password. If a token leaks, anyone holding it can pretend to be the rightful owner until it expires.
- A secret in GitHub Actions is a value stored encrypted by GitHub and injected into a workflow only when it runs. The secret in this story is called
BROWSER_AUTOMATION_BOT_TOKEN. - A supply chain attack means attacking not the final product directly, but one of the tools or steps used to build it. If you cannot break into the bank, you tamper with the armoured van that delivers the money. Here the tampered step is the cache that a build job trusts.
- An auth bypass (authentication bypass) means getting past a security check without the credentials the check was meant to require. The report labels the bug an auth bypass.
- Exfiltration means smuggling data out of a system to a place the attacker controls. Here the stolen secrets are sent to a gist, which is a small public or private snippet-hosting page on GitHub.
- npm is the package manager for JavaScript: the tool developers use to download and install code libraries.
npm ciis a command that installs exactly the dependencies listed in a lockfile, a file that pins every package to an exact version. - A tarball is a single archive file that bundles many files together, usually compressed. Think of it as a sealed box containing a whole folder.
- 2FA (two-factor authentication) means logging in with something you know plus something you have, such as a password plus a code from your phone. The report mentions a specific 2FA setup called wombat-dressing-room, which protects npm publishing.
Setup: what the attacker needed
The report does not describe any accounts, roles or tool versions. The only preconditions it names are:
- The
wpt.ymlworkflow runs and publishesmapper-headless-artifacts.zip. - A later workflow,
update-bidi-types.yml, consumes cache entries on themainbranch.mainis the default branch, the main line of development. - The attacker has a GitHub account able to run their own GitHub Action. The exploit does exactly that, every 5 minutes.
The exploit code itself is attached to the report as chrome-bidi-exploit-master.zip, and the log of the workflow run that created the malicious cache entry is attached as exploit.log.
Finding it: searching the public artifact
The reporter did not need any special access. They downloaded the artifact that the workflow publishes for anyone to grab, unpacked it, and searched inside for two particular environment variable names. The commands are run at the root of the extracted archive:
grep -r ACTIONS_CACHE_URL | awk '{print $2 $3}' | sort -u
grep -r ACTIONS_RUNTIME_TOKEN | awk '{print $2 $3}' | sort -u
Line by line:
grep -r ACTIONS_CACHE_URLsearches every file under the current folder, recursively (-r), for the textACTIONS_CACHE_URL.ACTIONS_CACHE_URLis the web address of the GitHub Actions cache service, the "where" of the fridge.| awk '{print $2 $3}'pipes the matching lines intoawk, a small text-processing tool. For each line, it prints the second and third space-separated words glued together. The idea is to strip away surrounding noise and keep the value next to the variable name.| sort -usorts the results and removes duplicates (-ufor unique), so you see each distinct value once.- The second command does the same for
ACTIONS_RUNTIME_TOKEN, which is the credential, the "key" to the fridge.
The result: both ACTIONS_CACHE_URL and ACTIONS_RUNTIME_TOKEN are present inside the artifact. The report adds two important details. The ACTIONS_RUNTIME_TOKEN is valid for 7 hours, and it keeps working even after the workflow run that produced it has finished. That is what turns a small leak into a real problem: the attacker has hours to use the key, and does not need the original job to still be running.
Exploitation: how the attack was carried out
The exploit runs on a schedule every 5 minutes through a GitHub Action. Here is what each step does and why.
Step 1: Clone the target repository
The exploit first clones the latest version of GoogleChromeLabs/chromium-bidi. Cloning means making a full local copy of the repository. The attacker needs this copy because the next steps involve building the project the same way the real workflow does.
Step 2: Force a new cache key
GitHub Actions cache entries cannot be overwritten. If you try to save under a key that already exists, nothing happens. So the exploit bumps the minor version of package-lock.json. The lockfile records exact versions of every dependency; changing a version number changes the resulting cache key. This gives the attacker a fresh label, so their poisoned box goes into the fridge instead of colliding with an existing one.
Step 3: Create cache entries in the attacker's repository
The exploit runs npm ci. According to the report, this uses google/wire-it under the hood. npm ci installs the exact dependency versions from the lockfile. As a side effect, it creates two cache entries in the repository running the exploit, that is, the attacker's own repo. Doing this in their own repo first lets the attacker see exactly what a cache entry looks like and prepare a tampered version.
Step 4: Build a poisoned cache tarball
The exploit downloads the latest cache entry tarball produced in the previous step, decompresses it, and creates a new one that includes a malicious cddlconv at /home/runner/.local/bin/. The malicious version is placed at /home/runner/.local/bin/. The malicious version, when run, dumps all the GitHub Actions secrets in memory and exfiltrates them to a gist. In plain terms: the attacker swaps a trusted tool for a fake one that, the moment it is used, copies every secret the job can see and posts them to a page the attacker controls.
Step 5: Harvest the leaked credentials
The exploit downloads a vulnerable artifact from the main branch of GoogleChromeLabs/chromium-bidi and extracts ACTIONS_CACHE_URL and ACTIONS_RUNTIME_TOKEN from it, using the same leak described above. This is the moment the stranger picks up the fridge key from the lobby table.
Step 6: Upload the poisoned entry to main
With those two values, the exploit uploads the poisoned cache entry to the main branch of GoogleChromeLabs/chromium-bidi. The leaked values are enough to upload the poisoned cache entry.
Delivery through update-bidi-types.yml
The poisoned cache entry is consumed by update-bidi-types.yml after a new version of chromium-bidi is released. The report says this happened on the day of filing: version 6.0.1 was released, and shortly afterwards the Send PR job of update-bidi-types.yml executed and consumed the following malicious cache entry:
{
"id": 75770,
"ref": "refs/heads/main",
"key": "[redacted]",
"version": "[redacted]",
"last_accessed_at": "2024-07-12T10:05:01.230000000Z",
"created_at": "2024-07-12T09:47:54.930000000Z",
"size_in_bytes": 446355
}
What each field means:
id: the internal number GitHub gave this cache entry.ref: the branch the entry belongs to, hererefs/heads/main. This is why the legitimate workflow picks it up: it looks for entries onmain, and the poisoned one is filed under exactly that branch.key: the label of the box, the cache key. The workflow asks for this key and gets this entry back.version: a second identifier GitHub uses to distinguish entries with the same key.last_accessed_at: when the entry was last read, here 2024-07-12 at 10:05:01 UTC.created_at: when the entry was written, here 2024-07-12 at 09:47:54 UTC.size_in_bytes: how large the entry is, 446355 bytes.
The entry is scoped to refs/heads/main. The attacker's job is done: the project's own automation now fetches the tampered box and runs what is inside.
What the stolen token can reach
The secret taken by the malicious cddlconv is BROWSER_AUTOMATION_BOT_TOKEN. The reporter enumerated the repositories accessible to it with:
curl -H "Authorization: token ghp_[REDACTED]" https://api.github.com/user/repos
Line by line:
curlis a command-line tool that sends web requests, like a browser without a window.-H "Authorization: token ghp_[REDACTED]"adds a header to the request. A header is extra information sent alongside a web request, like the "from" line on an envelope. This particular header carries the token, which is how GitHub knows who is asking. The token value is redacted here.https://api.github.com/user/reposis GitHub's API endpoint that lists the repositories the caller can access. An API (application programming interface) is a set of web addresses a program can call to get or change data, as opposed to a page meant for humans to look at.
The output is attached as enumeration.log. According to the report, the token grants push: write and pull: write access to:
- GoogleChromeLabs/chromium-bidi
- GoogleChromeLabs/webdriver-bidi-protocol
- puppeteer/puppeteer
push: write means the holder can upload changes to the repository. pull: write means the holder can act on the repository's pull requests. Together, that is a lot of power over three important projects.
Root cause: why this was possible
The workflow publishes an artifact that contains the runner's ACTIONS_CACHE_URL and ACTIONS_RUNTIME_TOKEN. Those values are the credentials for the GitHub Actions cache service, so anyone who can download the artifact can act on the repository's cache. The report does not describe which step of wpt.yml writes the variables into the artifact, only that they are present in it.
Two properties of the platform make the leak worse. Cache entries cannot be overwritten, which is why the exploit bumps the lockfile version to obtain a new key rather than replacing an existing entry. And the runtime token stays valid for 7 hours after the run finishes, so the window for abuse is much longer than the workflow itself.
The poisoned entry is only consumed when a new chromium-bidi version triggers update-bidi-types.yml, so the attacker has to wait for that event. But no interaction from the maintainers beyond a normal release is needed. They do what they always do, and the trap springs.
Impact: what an attacker could do
Anyone can exploit this, according to the report. With BROWSER_AUTOMATION_BOT_TOKEN, an attacker can:
- Write directly to any non-protected branch.
- Approve and merge pull requests from forks, and so push content to protected branches.
- Create releases and tags.
In the case of Puppeteer, the report says this could lead to publication of a malicious package in the npm registry. It also notes that because releases can be created directly in the puppeteer repository, this would even work with the wombat-dressing-room 2FA protection. In other words, the usual safety net for publishing packages would not stop it.
Fix
The issue is marked Fixed. The report itself contains no remediation guidance: the remediation section is empty. The commit referenced as proof is [redacted].
Variants to test: where else to look
- Search other public workflow artifacts for
ACTIONS_CACHE_URLandACTIONS_RUNTIME_TOKENwith the samegrepcommands. A positive result is both variables appearing in the output, which means the cache on that repository's default branch can be poisoned. - Check whether a repository's release process consumes cache entries on
main, for example a workflow that runs after a version bump. A positive result is a workflow that restores a cache key scoped torefs/heads/mainwithout any validation of the entry's contents. - Look for workflows that execute binaries from cache-restored paths such as
/home/runner/.local/bin/. A positive result is a cache entry whose contents are executed by a later job, which is the delivery mechanism used here. - Test whether tokens found in artifacts remain valid after the run completes. A positive result is a token that still authenticates to the cache API hours later, extending the attack window beyond the workflow run.
Glossary
- API (application programming interface): a set of web addresses a program can call to read or change data, as opposed to a page designed for humans.
- Artifact: a file that a workflow uploads so it can be downloaded later, such as a build output or report.
- Auth bypass (authentication bypass): getting past a security check without the credentials it was meant to require.
- Cache: a storage area where workflows keep reusable files so they do not have to rebuild them each time.
- Cache key: the label under which a cache entry is stored and later fetched.
- cddlconv: a program the project expects at
/home/runner/.local/bin/; the exploit replaces it with a malicious version. - Chromium: the open-source browser engine behind Google Chrome and other browsers.
- Clone: to make a full local copy of a repository.
- Commit: a saved change in a repository, identified by a long hash.
- curl: a command-line tool for sending web requests.
- Environment variable: a named value a running program can read, like a sticky note with a setting.
- Exfiltration: smuggling data out of a system to a place the attacker controls.
- GitHub: a website for storing and collaborating on source code.
- GitHub Actions: GitHub's system for running automated jobs (workflows) on temporary machines.
- Gist: a small snippet-hosting page on GitHub, used here as the destination for stolen secrets.
- Header: extra information sent with a web request, such as an authorisation token.
- Lockfile: a file that pins every dependency to an exact version so installs are reproducible.
- main: the default branch of a repository, the main line of development.
- npm: the package manager for JavaScript, used to download and install code libraries.
- npm ci: an npm command that installs exactly the versions listed in the lockfile.
- OSS VRP: Google's reward programme for security bugs in open-source software.
- Puppeteer: a tool developers use to automate Chrome.
- Repository (repo): a project's collection of code and history on GitHub.
- Runner: the temporary machine GitHub Actions uses to execute a workflow.
- Secret: a value stored encrypted by GitHub and injected into a workflow only when it runs.
- Supply chain attack: attacking a tool or step used to build a product rather than the product itself.
- Tarball: a single archive file bundling many files, usually compressed.
- Token: a long random string that acts like a temporary password.
- 2FA (two-factor authentication): logging in with something you know plus something you have, such as a password plus a phone code.
- WebDriver BiDi: a protocol, a shared language, that lets test tools drive a browser.
- Workflow: a recipe file in
.github/workflows/that tells GitHub Actions what to run and when. - wombat-dressing-room: a 2FA setup for npm publishing mentioned in the report.