Summary
A command injection vulnerability in the WPGraphQL GitHub Actions workflow allows arbitrary shell commands to be executed on the Actions runner when a pull request from develop to master is merged.
Because the workflow injects the pull request body directly into a run: shell block, a maliciously crafted PR description can break out of the intended command and execute attacker-controlled commands in the CI environment.
Affected context
This vulnerability affects repositories that:
- Use the WPGraphQL
release.ymlGitHub Actions workflow or derive workflows from it - Execute pull-request–driven release workflows on GitHub-hosted or self-hosted runners
- Incorporate
${{ github.event.pull_request.body }}(or similar user-controlled fields) directly into shell commands inrun:steps
The risk materializes when a pull request from develop to master is merged and the workflow automatically executes, treating the PR body as part of a shell command.
Exploit preconditions
- Attack surface: GitHub Actions workflow triggered on pull request merge (CI/CD pipeline).
- Required access: Ability to open or modify a pull request from
developtomasterin the affected repository (e.g., contributor, compromised account, or fork-based PR if permitted). - Trigger point: The automatic execution of the
release.ymlworkflow when the PR is merged, causing the PR body to be interpolated into arun:shell block. - Why exploitation is possible: The workflow directly interpolates untrusted, user-controlled text (
github.event.pull_request.body) into a shell command line without escaping or sanitization, so shell metacharacters in the PR body are interpreted as part of the command.
Why this happens
The root cause is a classic OS command injection pattern within a CI configuration.
The GitHub Actions workflow uses an expression (${{ github.event.pull_request.body }}) inside a run: block, which is executed by a shell (typically bash).
Because the PR body is fully under an attacker's control and is not quoted or sanitized, any shell metacharacters, command separators, or subshell constructs in the body are processed by the shell.
This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command, where untrusted input is concatenated into shell commands, allowing attackers to influence command parsing and execution.
Potential impact
- Execution of arbitrary commands on the GitHub Actions runner during the release workflow
- Theft or exfiltration of repository contents, build artifacts, or workflow secrets available to that job
- Tampering with build outputs, release artifacts, or changelogs produced by the pipeline
- Pivoting to other resources accessible from the runner (e.g., package registries, deployment endpoints, or self-hosted infrastructure)
- Disruption of CI/CD operations through deletion or corruption of intermediate files
General mitigation guidance
Effective mitigation focuses on breaking the direct flow from untrusted content to the shell and minimizing shell-based logic in CI:
- Avoid embedding untrusted template expressions (like PR bodies, titles, comments) directly inside
run:shell commands. - Prefer structured inputs and dedicated action parameters instead of free-form text for workflow configuration.
- When shell usage is unavoidable, treat all externally influenced values as untrusted and:
- Pass them as environment variables to scripts where they are safely handled as data.
- Apply strict quoting and escaping, and avoid constructing command lines via string concatenation.
- Use purpose-built GitHub Actions or scripts that process PR metadata as data, not as part of command invocations.
- Limit the permissions and secrets available to workflows that process user-controlled data, using least privilege and fine-grained token scopes.
How teams detect issues like this
Detecting similar issues typically involves inspecting CI/CD definitions and enforcing secure patterns:
- Static analysis and linting: Scan workflow files (e.g.,
.github/workflows/*.yml) for: run:steps that interpolate${{ github.* }}or${{ env.* }}directly into shell commands.- Unquoted or partially quoted interpolations next to shell metacharacters.
- Code review signals: Flag workflows that:
- Consume PR body, title, comments, or issue text in shell commands.
- Build command strings via concatenation instead of using arguments or environment variables.
- Policy enforcement: Use repository policies or CI governance tools to:
- Require security review for changes to workflow files.
- Block patterns known to be unsafe (e.g., direct use of user-controlled GitHub context fields in
run:). - Automated tooling: Integrate workflow-specific security scanners or general SAST tools that understand GitHub Actions syntax and can highlight command injection risks in pipeline definitions.

