Skip to content
Advisory Intermediate

GHSL-2020-315: Unauthorized repository modification or secrets exfiltration in the GitHub workflow of rux616/karabiner-windows-mode

The GitHub workflow used pull_request_target and explicitly checked out and ran code from a fork, so untrusted code ran with a read/write token and access to secrets. An attacker could modify the base repository or exfiltrate secrets.

jarlob Follow

Originally disclosed on GitHub Security Lab

The acceptance-tests.yaml GitHub workflow is vulnerable to unauthorized modification of the base repository or secrets exfiltration from a Pull Request.

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

The workflow used pull_request_target but then checked out and executed code from the pull request head, giving untrusted code the privileges of the base repository.

Impact

The vulnerability allows for unauthorized modification of the base repository and secrets exfiltration.

What the attacker needed

Ability to fork the repository; ability to open a pull request

The fix

The issue was resolved, but the text does not state how; it should be fixed by not checking out or running untrusted code in a pull_request_target workflow.

How it was found

  1. Fork the repository and create a pull request to master.
  2. The pull_request_target workflow triggers and checks out the pull request head commit.
  3. The workflow runs the build script from the fork, executing attacker-controlled code.
  4. The code can push to the base repository or access secrets.

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 workflow is an automated script that runs when something happens, like a pull request. The pull_request_target trigger gives the workflow powerful permissions and secrets, but it is supposed to run only trusted code. Here the workflow checked out and ran code from the pull request itself, so an attacker could use that code to change the repository 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.