GHSL-2020-229: Command injection in allenevans/set-env workflow
A GitHub Actions workflow used a commit message directly in a shell command, allowing an attacker to inject arbitrary commands by crafting a malicious commit message. This could let the attacker exfiltrate secrets, make commits, or subvert the release process.
The ‘release.yml’ GitHub workflow is vulnerable to arbitrary command injection.
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
Impact
The attacker could exfiltrate secret tokens, make arbitrary commits, or subvert the release step, affecting dependent repositories.
What the attacker needed
Ability to create a commit and pull request; pull request must be merged; reviewer does not notice payload
The fix
The workflow should avoid using untrusted commit messages directly in shell commands, for example by passing them through environment variables or sanitising them.
How it was found
- Create a commit with a malicious message.
- Open a pull request containing that commit.
- Get the pull request merged (reviewer may miss the payload).
- The workflow runs on push to master and executes the injected 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 push. Here, the workflow took the text of a commit message and pasted it straight into a shell command. An attacker could write a commit message that contains extra shell commands, which would then run with the workflow's permissions.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.