T09 · Insecure Skill Coding Practices
- Location
workflow.json:58- Finding
Shell Command Injection Through Unvalidated Workflow Parameters
- Content
View full analysis
=${since}\" --json number,title,author,createdAt,changedFiles,additions,deletions --jq '.[]'", "get_diff": "gh pr diff ${pr_number} --repo ${repo} > /tmp/pr_${pr_number}.diff", "get_commits": "gh api repos/${repo}/commits?since=${since_unix}&until=${until_unix} --jq '.[].commit.message'" } ``` ### Technical Analysis The workflow constructs shell command strings by directly interpolating `${repo}`, `${since}`, `${pr_number}`, `${since_unix}`, and `${until_unix}`. The project does not define validation, allowlisting, or shell-safe escaping for these values. Several values originate from invocation arguments or user-controlled configuration. If the workflow engine expands these templates before passing the resulting text to a shell, shell metacharacters, redirections, separators, or command substitutions in a crafted value will be interpreted as shell syntax. The double quotes around `${since}` are insufficient protection because command substitution remains active inside double-quoted shell strings. The unquoted `${repo}` and `${pr_number}` substitutions are additionally exposed to word splitting, glob expansion, and shell control operators. ### Attack Path 1. An attacker gains the ability to supply a repository, date, or related workflow parameter through CLI arguments, configuration, or an automation system invoking the Skill. 2. The attacker supplies a value containing shell syntax instead of the expected repository, integer, or date format. 3. The workflow engine interpolates the value into one of the shell command templates. 4. The generated command is executed by a shell. 5. The shell interprets the injected syntax and executes attacker-selected commands with the privileges and environment of ...[truncated 988 chars]- Remediation
View remediation
