Skip to content
Advisory Intermediate

GHSL-2021-047: unauthorized repository modification or secrets exfiltration in GitHub workflows of zwavejs2mqtt

The GitHub workflow allowed a pull request author to trigger a privileged build of untrusted code, and also used unsanitised pull request branch names and titles in shell commands. An attacker could modify the base repository or exfiltrate secrets.

jarlob Follow

Originally disclosed on GitHub Security Lab

The zwave-js-bot.yml GitHub workflow is vulnerable to unauthorized modification of the base repository or secrets exfiltration.

jarlob, on GitHub Security Lab

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the workflow's authorization check allowed the pull request author to trigger a privileged build, and it inserted untrusted pull request data directly into shell commands without sanitisation.

Impact

The workflow had access to a write repository token and secrets, so an attacker could modify the base repository or exfiltrate secrets.

What the attacker needed

A GitHub account; ability to comment on a pull request; being the pull request author or an authorized user

The fix

The issue was fixed.

How it was found

  1. A user comments on a pull request with a specific command.
  2. The workflow checks if the commenter is authorized, but also allows the pull request author.
  3. The workflow checks out the pull request code and runs npm install.
  4. The workflow uses the pull request branch name and title in git commands without sanitisation.

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 report has not been written yet. The Original tab links to the source.

A GitHub Actions workflow is an automated script that runs when something happens on GitHub, like a comment. This workflow ran with powerful permissions and secrets. Because it trusted input from a pull request author and inserted that input directly into commands, an attacker could run their own code or steal secrets.

More by jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.