Skip to content
RCE Advisory Intermediate

GHSL-2020-319: Arbitrary code execution in pangeo-data/climpred workflows

The GitHub workflows triggered on pull_request_target checked out and ran code from a fork, giving the untrusted code access to the base repository's write token and secrets. An attacker could modify the base repository or exfiltrate secrets by submitting a malicious pull request.

jarlob Follow

Originally disclosed on GitHub Security Lab

The climpredinstalls.yml and climpredtesting.yml GitHub workflows in multiple branches 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

Root cause

The workflows used the pull_request_target trigger, which grants write access and secrets, but then explicitly checked out and executed code from the untrusted fork.

Impact

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

What the attacker needed

GitHub account; Ability to fork the repository; Ability to open a pull request

The fix

The issue was fixed by changing the workflow trigger or removing the checkout of untrusted code, as indicated by the timeline.

How it was found

  1. Fork the repository and create a pull request with a modified setup.py or requirements file.
  2. The pull_request_target workflow triggers and checks out the fork's code.
  3. The workflow runs pip install -e . or pytest, executing the attacker's code.
  4. The attacker's code can push to the base repository or exfiltrate 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 workflows can run automatically when someone opens a pull request. If a workflow uses the pull_request_target trigger, it runs with extra permissions and can access secrets. Here, the workflow checked out and ran code from the pull request itself, so an attacker could include malicious code that steals secrets or changes the repository.

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.