Summary
Emissary's pre-8.39.0 GitHub Actions workflows interpolated user-controlled workflow_dispatch inputs directly into shell commands using ${{ }} expressions.
An attacker with repository write access could inject arbitrary shell commands into these workflows, potentially poisoning the repository and compromising the software supply chain for downstream consumers.
Affected context
This vulnerability occurs in Emissary projects that:
- Use the bundled GitHub Actions workflows provided prior to version 8.39.0
- Expose
workflow_dispatchor similar inputs that are partially or fully user-defined - Construct shell commands by directly interpolating
${{ inputs.* }}or other user-controlled values intorun:steps
The risk is most relevant when these workflows are used in automated build, packaging, or release pipelines that are trusted by downstream users or systems.
Exploit preconditions
- Attack surface: GitHub Actions CI/CD workflows associated with an Emissary repository.
- Required access: Repository write access (e.g., collaborator, compromised maintainer account, or malicious fork merged to default branch).
- Trigger point: Execution of a GitHub Actions workflow that:
- Accepts user-controlled
workflow_dispatchinputs (or similar) - Embeds those inputs directly in shell commands within
run:steps - Why exploitation is possible: The workflow interpolates untrusted data into shell commands without quoting, validation, or separation between data and code, allowing crafted input to break out of expected arguments and execute arbitrary commands.
Why this happens
The underlying issue is improper construction of shell commands in GitHub Actions workflows, where user-controlled values are treated as trusted command fragments.
Instead of treating workflow_dispatch inputs as opaque data, the workflows embedded them directly inside run: steps using ${{ }} expression syntax.
This corresponds to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where shell metacharacters and control operators in user input are not neutralized, enabling attackers to alter command structure and execute arbitrary OS-level commands in the CI environment.
Potential impact
- Execution of arbitrary shell commands within GitHub Actions runners.
- Injection of malicious code into the repository (repository poisoning).
- Unauthorized modification of build artifacts, container images, or release packages.
- Insertion of backdoors or malware into distributed binaries, libraries, or workflows.
- Credential theft from CI secrets (tokens, keys, and other sensitive configuration).
- Downstream supply-chain compromise affecting users who consume generated artifacts.
General mitigation guidance
Effective mitigation focuses on separating user input from command execution and minimizing trust in CI-supplied data:
- Prefer parameterized invocations of scripts or tools that receive input as arguments or environment variables, not as raw command fragments.
- Avoid constructing shell commands by concatenating or interpolating
${{ inputs.* }}directly; instead, pass inputs as variables and handle them inside scripts that can validate or sanitize them. - Apply strict validation on workflow inputs (e.g., enumerated
choices, regex constraints, or restricted formats) to limit allowable values. - Use shell-safe quoting patterns when interpolation is unavoidable, and avoid allowing control characters such as
;,&,|, backticks, or$()in inputs. - Run CI jobs with least-privilege tokens and scoped permissions to reduce the blast radius if a command is abused.
- Treat release pipelines as high-trust contexts and minimize the number of workflows and inputs that can influence them.
How teams detect issues like this
Detection generally involves reviewing workflows for unsafe shell construction patterns:
- Static analysis: Scan
.github/workflows/*.ymlforrun:steps where${{ inputs.* }},${{ github.event.inputs.* }}, or other user-controlled expressions are embedded directly into shell commands, especially near metacharacters. - Code review signals: Flag workflows that:
- Use string concatenation to build shell commands.
- Accept free-form text inputs that influence
run:without validation. - Run in high-privilege contexts (e.g., release or publish steps) while consuming untrusted inputs.
- Policy enforcement: Apply repository or organization policies that require:
- Centralized review of CI workflows.
- Use of approved composite actions or scripts instead of ad hoc shell fragments.
- CI linting tools that enforce safe patterns for command execution and input handling.
- Automated security tools or GitHub Apps can be configured to inspect workflow changes and block merges that introduce new command injection sinks.

