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.
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.
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
- Fork the repository and create a pull request with a modified setup.py or requirements file.
- The pull_request_target workflow triggers and checks out the fork's code.
- The workflow runs pip install -e . or pytest, executing the attacker's code.
- 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.