T09 · Insecure Skill Coding Practices
- Location
references/build-passwall.yml:283- Finding
Shell Injection Through Unvalidated Workflow Inputs
- Content
View full analysis
Vulnerability Details
File Location:
references/build-passwall.yml:283-284
Vulnerability Type: Workflow input command injection
Risk Level: Highyaml SDK_VERSION="${{ inputs.sdk_version }}" OPENSSL_TAG="${{ inputs.openssl_tag }}"Technical Analysis
The free-form
sdk_versionandopenssl_taginputs are interpolated directly into a generated shell script before the runner executes it. GitHub expression substitution occurs before shell parsing, so shell metacharacters, quotation marks, command substitutions, or newlines in an input can terminate the assignment and introduce additional commands.Quoting the GitHub expression inside the assignment does not make it safe because attacker-controlled quotation marks are inserted into the script itself. Both affected inputs are required but have no choice restriction or allowlist validation.
Attack Path
- An attacker or compromised account with permission to dispatch the workflow provides a crafted value for
sdk_versionoropenssl_tag. - GitHub substitutes that value directly into the
runscript. - The crafted value escapes the shell assignment and introduces an arbitrary command.
- The GitHub-hosted runner executes the injected command in the build job.
- The injected code can access the job environment and exercise the workflow's repository write permissions.
Impact Assessment
Successful exploitation permits arbitrary command execution on the GitHub Actions runner. The job declares
contents: writeand exposesGITHUB_TOKENin its environment, so injected commands may alter repository contents or releases, replace generated artifacts, access data available to the job, and publish malicious installers. The scope is constrained by the permissions assigned to the workflow token and the attacker's ability to dispatch the workflow.- An attacker or compromised account with permission to dispatch the workflow provides a crafted value for
- Remediation
View remediation
Remediation Suggestions
- Do not embed untrusted GitHub expressions directly in shell source.
- Pass values through the step's
envmapping and reference them as quoted runtime variables. - Validate
sdk_versionandopenssl_tagagainst strict allowlists before use. For example, reject values outside a conservative pattern such as alphanumeric characters, periods, underscores, and hyphens. - Prefer
choiceinputs when the acceptable values are known in advance. - Keep workflow permissions read-only by default and grant
contents: writeonly to the release step or a separate job after successful validation. - Add automated tests using quotation marks, command substitutions, newlines, and shell metacharacters to verify that malicious input is rejected.
