Skip to content
RCE Advisory Intermediate

GHSL-2020-334: Arbitrary code execution in gsantner workflows

Three GitHub Actions workflows used the pull_request_target trigger but then checked out and built code from the pull request's fork. An attacker could open a pull request from a fork and have their code run with a read/write token for the base repository and access to its secrets.

jarlob Follow

Originally disclosed on GitHub Security Lab

The markor/build-android-project.yml, memetastic/build-android-project.yml and dandelion/link-validator.yml GitHub workflows are 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

Impact

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

What the attacker needed

A GitHub account; ability to fork the repository; opening a pull request from the fork

The fix

The issue was resolved, though the text does not describe the change; the workflow should avoid running fork code under pull_request_target with base-repository tokens and secrets.

How it was found

  1. Fork one of the affected repositories.
  2. Open a pull request from the fork against the base repository.
  3. The workflow checks out the fork's head branch and runs its build script with the base repository's token and 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.

GitHub Actions are automated jobs that run when something happens in a repository, such as a new pull request. The pull_request_target trigger was meant to let these jobs act on pull requests safely, but here the job also downloaded and ran the contributor's own code, so a stranger could get the job to run their code with the project's permissions and secrets.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

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

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.