GHSL-2020-274: Arbitrary code execution in v8/v8.dev workflow
The GitHub Actions workflow used pull_request_target but then checked out and ran code from the pull request's fork, giving untrusted code access to the base repository's write token and secrets. An attacker could open a pull request from a fork to modify the base repository or exfiltrate secrets.
The pr-preview.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
Impact
The vulnerability allows for unauthorized modification of the base repository and secrets exfiltration.
What the attacker needed
Ability to open a pull request from a fork
The fix
The issue was resolved, but the text does not state the exact fix; it should be fixed by not checking out or running untrusted fork code in a pull_request_target workflow.
How it was found
- Open a pull request from a fork against the base repository.
- The pull_request_target workflow triggers and checks out the fork's code.
- The workflow runs npm install, lint and build on the untrusted code.
- The untrusted code can then push to the base repository or read 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 can run automated tasks when someone opens a pull request. A setting called pull_request_target gives those tasks powerful permissions, so they should never run code from the pull request itself. Here the workflow did run that code, letting an outsider change the project or steal secret values.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.