Fix Actions script injection vulnerability in issue-slash-commands.yaml#4493
Merged
ChrisTitusTech merged 2 commits intoMay 14, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/ChrisTitusTech/winutil/sessions/94895aac-198f-40b6-af42-27fe0c646587 Co-authored-by: ChrisTitusTech <7896101+ChrisTitusTech@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix script injection vulnerability in issue-slash-commands.yaml
Fix Actions script injection vulnerability in issue-slash-commands.yaml
May 14, 2026
ChrisTitusTech
approved these changes
May 14, 2026
Owner
|
Credit to Nahuel Sanchez, Security Consultant, for Kulkan for finding the vulnerability. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
github.event.comment.bodyandgithub.event.comment.user.loginwere interpolated directly intorun:shell steps via${{ }}, enabling arbitrary command execution by any issue commenter. The allowlist check ran after the vulnerable steps, providing no protection.Changes
run:steps with a singleactions/github-script@v7step — comment body is read as a JavaScript value, never passed to a shellgithub.rest.issues.*) instead ofghCLI with interpolated strings/label,/unlabel,/close(withnot planned→state_reason: not_planned),/open,/reopen/label 'name'and/label nameare supportedBefore / After
Original prompt
Fix an Actions script injection vulnerability in
.github/workflows/issue-slash-commands.yamlin repositoryChrisTitusTech/winutil.Context:
issue_commentoncreatedandedited.github.event.comment.bodydirectly inside multiplerun:shell scripts.${{ }}expressions before the shell parses the script, this allows command injection from issue comments.Source file to fix:
.github/workflows/issue-slash-commands.yamlRequirements:
github.event.comment.bodyand any other attacker-controlled derived values into shell source inrun:steps./label 'name'/unlabel 'name'/close/open/reopennot plannedclose behavior if feasible.actions/github-scriptto parse comment body as data rather than shell source, and/orSuggested direction:
actions/github-script, set outputs, and call the GitHub API directly for close/reopen/label operations instead of shelling out toghwith attacker-controlled data.Deliverable:
mainwith the workflow fixed.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: ````
Summary
The
Issue slash commandsworkflow (`.github/workflows/issue-slash-commands.yaml`) is vulnerable to Actions script injection. Multiple `run:` steps interpolate the untrusted, attacker-controlled `github.event.comment.body‘expression directly into shell scripts. BecauseGitHubActionsexpands‘{{ }}` expressions before the shell parses the script, any user who can comment on an issue in this repository can execute arbitrary commands on the workflow runner.The existing ALLOWED_USERS allowlist does not mitigate this issue, because the user check runs in a step after the vulnerable commands have already executed.
Affected Component
Repository: ChrisTitusTech/winutil
File: .github/workflows/issue-slash-commands.yaml
Branch: main
Trigger: issue_comment (types: [created, edited])
Vulnerable Code
The /close and /open|/reopen checks contain the same pattern via contains(github.event.comment.body, ...) followed by further use of the value. A secondary injection sink exists in the Label issue / Remove labels steps, which interpolate ${{ env.label_name }} (derived from attacker input) into another run: block.
Proof Of Concept
Comment the following in any open issue:
You'll receive the GitHub Token in the attacker controlled server.