Summary
KanaDojo's GitHub Actions release workflow is vulnerable to command injection when values from patchNotesData.json are interpolated directly into a child_process.execSync() shell command.
An attacker with pull request access can craft malicious version or changes fields that, once merged, execute arbitrary commands on the Actions runner with contents write permissions and access to GITHUB_TOKEN.
Affected context
This vulnerability appears in the KanaDojo project's automated release pipeline, specifically within a GitHub Actions workflow (release.yml) that runs on merged pull requests.
The workflow reads user-controlled fields (such as version and changes) from patchNotesData.json and embeds them directly into a shell command executed via child_process.execSync().
The issue manifests when the CI runner is granted write access to the repository contents and uses the default GITHUB_TOKEN for subsequent API or git operations.
Exploit preconditions
- Attack surface: CI/CD (GitHub Actions) release workflow triggered on pull request merge
- Required access: Ability to open a pull request that modifies patchNotesData.json (e.g., contributor-level access)
- Trigger point: Execution of the release.yml workflow, which calls child_process.execSync() with interpolated data from patchNotesData.json
- Why exploitation is possible: User-supplied fields (version and/or changes) are inserted into a shell command without escaping, quoting, or validation, allowing shell metacharacters to alter the intended command and inject arbitrary commands
Why this happens
The core issue is the direct interpolation of untrusted data into a shell command executed by child_process.execSync().
This pattern falls under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where input that should be treated as data is instead interpreted by the shell as part of the command.
By failing to sanitize or strictly validate the version and changes fields from patchNotesData.json, and by using a shell-based execution API instead of argument-safe process spawning, the workflow allows attackers to introduce shell metacharacters that change the behavior of the command executed on the CI runner.
Potential impact
- Execution of arbitrary OS commands on the GitHub Actions runner
- Modification or deletion of repository contents via contents write permissions
- Abuse of GITHUB_TOKEN to create or modify releases, tags, or pull requests
- Exfiltration of repository data or workflow secrets accessible to the job
- Tampering with build artifacts or release assets in the pipeline
General mitigation guidance
Effective mitigation centers on removing the trust boundary violation between user-controlled data and shell commands.
Common defensive patterns include:
- Avoiding shell-based execution for dynamic values by using safer APIs (e.g., child_process.spawn with explicit argument arrays, or dedicated library calls) instead of exec/execSync
- Treating values from patchNotesData.json as data only and never as part of shell syntax; enforcing strict validation and whitelisting on version strings and change descriptions
- Applying robust escaping or quoting routines if interaction with a shell is unavoidable, ensuring shell metacharacters are neutralized
- Reducing CI job privileges by limiting GITHUB_TOKEN scopes and disabling unnecessary write permissions where possible
- Isolating release automation steps that rely on untrusted inputs and running them in contexts that lack sensitive credentials or write access
How teams detect issues like this
Organizations can identify similar issues by:
- Using static analysis or linters that flag unsafe usage of child_process.exec/execSync with interpolated or concatenated strings derived from user or file input
- Reviewing CI/CD configuration (e.g., GitHub Actions YAML) for commands that inject JSON or other user-controlled content into shell pipelines without validation
- Implementing secure coding guidelines and code review checklists that require justification for any shell invocation in automation scripts
- Enforcing security-focused checks in pull request workflows, including pattern-based scanning for command injection risks and over-privileged GITHUB_TOKEN configurations

