GHSL-2024-322: Poisoned Pipeline Execution (PPE) via code injection in Sympy
The comment-on-pr workflow downloads an artifact from a pull request and interpolates its contents directly into a shell command, allowing a malicious actor to run arbitrary code. Because the workflow has full write permissions, an attacker could gain write access to the repository and exfiltrate secrets.
Originally disclosed on GitHub Security Lab
The comment-on-pr.yml workflow is vulnerable to Poisoned Pipeline Execution (PPE) which may allow a malicious actor to gain write access to the repository and exfiltrate secrets.
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 contents of an attacker-controlled artifact as part of a shell command without sanitisation, and the workflow ran with write permissions.
Impact
An attacker could gain write access to the repository and exfiltrate secrets.
What the attacker needed
Ability to fork the repository; ability to open a pull request
The fix
The vulnerable workflow was removed.
How it was found
- Fork the repository and create a new branch.
- Modify the runtests.yml workflow to write a command into pr_number.txt and upload it as an artifact named pr_number.
- Create a pull request with this change to sympy/sympy.
- Watch the execution of runtests.yml and comment-on-pr.yml, which should show the output of the id command.
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 pull request. This workflow took a file uploaded by the pull request and pasted its contents straight into a command, so the file could contain extra commands that the workflow would run with powerful permissions.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.