GHSL-2024-325_GHSL-2024-326: Poisoned Pipeline execution via Code Injection and Execution of untrusted code in Actual
A GitHub Actions workflow triggered by a PR comment checked out untrusted pull request code and ran a local action from it, and also interpolated the attacker-controlled branch name into a shell script. An attacker could therefore run arbitrary code in a job holding write permissions on the repository.
Originally disclosed on GitHub Security Lab
The update-vrt.yml workflow is vulnerable to Poisoned Pipeline execution via Code Injection and Execution of untrusted code
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 ran untrusted pull request content (a local action and an interpolated branch name) inside a job granted write permissions.
Impact
An attacker could gain write access to the repository through the workflow's write permissions.
What the attacker needed
Ability to open a pull request; ability to comment on the pull request
The fix
The issue was fixed by a later pull request, after an earlier permissions change was found insufficient.
How it was found
- Open a pull request against the repository.
- Add a comment containing the trigger phrase to start the workflow.
- The workflow checks out the pull request branch and runs the local setup action from it.
- The branch name is inserted into the commit and push shell script, so a crafted name runs commands.
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.
This project uses GitHub Actions, which are automated jobs that run when something happens on GitHub, such as a comment on a pull request. One job trusted code from the pull request itself and also pasted the branch name straight into a shell command, so anyone who opened a pull request could get their own commands run. Because that job was allowed to write to the repository, the attacker could change the project's code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.