GHSL-2021-012: Command injection in alan-turing-institute/binderhub-deploy workflow
A GitHub Actions workflow used the body of an issue comment directly in a shell command, so an attacker could inject arbitrary commands by posting a crafted comment. This allowed unauthorised modification of the base repository and exfiltration of secrets.
GitHub workflow in alan-turing-institute/binderhub-deploy GitHub repository repository is vulnerable to arbitrary code execution from user comments.
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 interpolated the untrusted comment body directly into a shell command without sanitisation or quoting.
What the attacker needed
Ability to comment on an issue
The fix
The issue was resolved, likely by avoiding direct interpolation of the comment body into shell commands.
How it was found
- Create an issue comment containing a crafted string that starts with the expected trigger and includes shell metacharacters.
- The workflow triggers on the issue_comment event and runs the shell command that includes the comment body.
- The injected shell commands execute, allowing modification of the repository and exfiltration of secrets.
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 on GitHub, like a new comment. Here, the workflow took the text of a comment and pasted it straight into a shell command without checking it. An attacker could write a comment that includes extra shell commands, and those commands would 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.