GHSL-2020-283: Unauthorized repository modification or secrets exfiltration in the GitHub workflow of GoogleCloudPlatform/functions-framework-ruby
The GitHub workflow used pull_request_target and explicitly checked out and ran 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.
The release-hook-on-open.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 create a pull request from a fork
The fix
The issue was resolved before the report was received, likely by not checking out and running untrusted code in a pull_request_target workflow.
How it was found
- Create a pull request from a fork to the base repository.
- The workflow triggers on pull_request_target events.
- The workflow checks out the merge ref of the pull request.
- The workflow runs the Toys release _onopen command, which executes code from the fork.
- The malicious code can use the GITHUB_TOKEN to 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.
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 a token that can write to the repository and access secrets. The mistake was to check out and run code from the pull request itself, so an attacker could put malicious code in their fork and have it run with those powerful permissions.