GHSL-2020-273: Unauthorized repository modification or secrets exfiltration in a GitHub workflow of numworks/epsilon
The GitHub workflow used pull_request_target and then checked out and built code from a fork, giving 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 metrics-workflow.yml GitHub workflow is 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 workflow used pull_request_target, which grants write token and secrets, and 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
Ability to create a pull request from a fork
How it was found
- Fork the repository and create a pull request with malicious code.
- The workflow triggers on pull_request_target.
- The workflow checks out the pull request head.
- The workflow runs the build command on the checked-out code.
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, including write access to the main repository and access to secrets. The workflow then downloaded and ran code from the pull request, so an attacker could make that code do harmful things.