A GitHub Actions workflow uses untrusted user input from issue_comment.body directly inside a shell command, allowing potential command injection and arbitrary code execution on the runner.
The workflow is triggered by issue_comment, which can be controlled by external users.
In the following step:
echo identifiers=$(echo "${{ github.event.comment.body }}" | grep -oE '@njzjz-bot .*' | head -n1 | cut -c12- | xargs) >> $GITHUB_OUTPUT
the value of github.event.comment.body is directly interpolated into a shell command inside run:.
Since GitHub Actions evaluates ${{ }} before execution, attacker-controlled input is injected into the shell context without sanitization. This creates a command injection risk.
Additionally, the extracted value is later reused in another step that constructs output using backticks:
echo '@${{ github.event.comment.user.login }} Here is the BibTeX entry for `${{ steps.extract-identifiers.outputs.identifiers }}`:'
which may further propagate unsafe content.
@njzjz-bot paper123" ) ; whoami ; #
The injected payload successfully breaks out of the quoted context and executes arbitrary shell commands.
As shown in the workflow logs, the injected whoami command is executed, and the output (runner) is printed. This confirms that attacker-controlled input from github.event.comment.body is interpreted as shell commands.
This demonstrates a clear command injection vulnerability in the workflow.
Remote attackers can inject arbitrary shell commands via issue comments
Potential impacts:
GITHUB_TOKEN
*...Exploitability
AV:NAC:LPR:NUI:NScope
S:UImpact
C:HI:HA:H9.8/CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H