GHSL-2020-370: Arbitrary code execution and shell command injection in rhinstaller/anaconda workflows
Two GitHub Actions workflows in the rhinstaller/anaconda repository were vulnerable: one checked out and ran untrusted code from a pull request fork with access to secrets and write tokens, and another used a comment body to format a shell command, allowing command injection. An attacker could modify the base repository or exfiltrate secrets.
The validate.ymland kickstart-tests.yml GitHub workflows are vulnerable to unauthorized modification of the base repository or secrets exfiltration from a Pull Request.
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 workflows used pull_request_target (which gives access to secrets and write tokens) while checking out and running code from the pull request fork, and one workflow directly interpolated a comment body into a shell command without sanitisation.
What the attacker needed
Ability to fork the repository; ability to create a pull request; ability to comment on an issue
The fix
The issue was resolved after discussion with the maintainer, but the text does not specify the fix.
How it was found
- Fork the repository and create a pull request with malicious changes.
- The workflow triggered on pull_request_target checks out the fork's code and runs the build script.
- The malicious code executes with access to secrets and write tokens.
- For the second issue, comment on an issue with a crafted string starting with '/kickstart-test' that includes shell metacharacters.
- The workflow parses the comment body and injects it into a shell command, executing arbitrary 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.
GitHub Actions are automated tasks that run when something happens in a repository, like a pull request. If these tasks run code from an untrusted source or use user input in shell commands without sanitising it, an attacker can take control and steal secrets or change 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.