GHSL-2024-254: Poisoned Pipeline Execution (PPE) in Amplification leading to potential acccount takeover
The pr-labeler.yml workflow used pull_request_target and checked out the attacker's pull request code, then ran bun install, allowing arbitrary code execution. An attacker could execute commands with full write permissions, potentially taking over the repository.
Originally disclosed on GitHub Security Lab
Amplification is vulnerable to Poisoned Pipeline Execution (PPE) allowing malicious actors to take over the repository.
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 the pull_request_target event and checked out the attacker-controlled pull request code, then executed bun install, which runs scripts from package.json.
Impact
This issue may lead to full repository take over.
What the attacker needed
GitHub account; Ability to create a pull request
The fix
The issue was fixed by commits 32b704d and 4395bb9.
How it was found
- Install the gh CLI tool.
- Clone the amplication/amplication repository.
- Create a new branch named poc.
- Modify package.json to include a preinstall script with arbitrary commands.
- Commit the changes and create a pull request using gh pr create.
- Observe the workflow run and the output of the Install Dependencies step.
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 a set of automated steps that run when something happens, like a pull request. Here, the workflow ran code from the pull request itself, so an attacker could include a script that runs commands on the server. Because the workflow had write access to the repository, the attacker could change code or settings.