GHSL-2024-207: Pull requests write permission in k3s via Poisoned Pipeline Execution (PPE)
The k3s repository's trivy workflow runs on issue comments and checks out attacker-controlled pull request code, then executes make targets. An attacker could modify the Makefile in a pull request and trigger the workflow with a comment to gain write permissions to the repository.
Originally disclosed on GitHub Security Lab
The k3s repository is vulnerable to Poisoned Pipeline Execution (PPE). An attacker can gain pullrequests: write permission by sending a Pull Request and adding a comment to it.
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 triggers on issue comments and checks out untrusted pull request code, then executes make targets from that code without restricting permissions.
Impact
This could lead to the injection of malicious code into the repository.
What the attacker needed
Ability to open a pull request; ability to comment on the pull request
The fix
The issue was fixed in PR#10935.
How it was found
- Create a pull request that modifies the Makefile to add malicious code to the local target.
- Add a comment containing /trivy to the pull request.
- The workflow triggers, checks out the pull request code, and runs make local, executing the malicious code.
- The attacker gains write permissions to the repository.
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 when something happens, like a comment. Here, the workflow runs when someone comments '/trivy' on a pull request. It then downloads the code from that pull request and runs 'make', which executes instructions from the attacker's modified Makefile. This lets the attacker run their own code with the workflow's permissions, which include writing to the repository.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.