GHSL-2024-163: GitHub's workflow unit-tests.yml is vulnerable to arbitrary code execution
The unit-tests.yml workflow could be triggered by a pull request that modifies the crowdin.yml workflow, causing it to check out and run untrusted code from the PR. An attacker could then execute arbitrary commands with full write permissions, potentially taking over the repository.
Originally disclosed on GitHub Security Lab
The unit-tests.yml GitHub’s workflow is vulnerable to arbitrary code execution.
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
Likely the unit-tests workflow was triggered by another workflow that could be modified via pull request, and it checked out and executed untrusted code with full write permissions.
Impact
The issue may lead to repository takeover.
What the attacker needed
Ability to open a pull request
How it was found
- Create a pull request that changes the crowdin.yml workflow to trigger on pull_request.
- In the same pull request, modify the package.json scripts to replace the test script with a malicious command.
- The unit-tests workflow runs, checks out the pull request code, and executes the malicious test script with full write permissions.
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 Actions workflow is an automated script that runs on GitHub when certain events happen, like a push or a pull request. Here, a workflow that runs tests could be tricked into running code from an attacker's pull request, and because it had write access to the repository, the attacker could take over 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.