Summary
Conflibot constructs Git commands by interpolating attacker-controlled pull request branch names into shell commands. In the documented pull_request_target workflow, a malicious branch name can cause commands to execute automatically on a repository runner, potentially exposing secrets and enabling unauthorized repository or token activity.
Affected context
The vulnerability occurs in Conflibot workflows that process pull request head branch names and pass constructed Git commands to a shell through exec. Risk is greatest when the workflow uses pull_request_target, runs for contributions from forks, and grants the runner access to base-repository secrets or a write-scoped GITHUB_TOKEN. Exploitation does not require maintainer interaction when the workflow automatically evaluates the attacker-controlled branch name.
Exploit preconditions
- Attack surface: Automated GitHub Actions workflow handling pull request events
- Required access: Ability to open a pull request or otherwise control its head branch name
- Trigger point: Workflow execution that builds Git commands from the pull request
head.ref - Why exploitation is possible: Shell metacharacters embedded in the branch name are interpreted as command syntax when interpolated into strings passed to
exec - Environmental condition: The runner must have reachable secrets, repository permissions, or token capabilities that make command execution consequential
Why this happens
The underlying bug is OS command injection caused by combining attacker-controlled branch data with shell command strings. Rather than treating the branch name as a discrete argument, the vulnerable implementation interpolates it into commands executed by a shell. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because shell metacharacters can alter the intended command structure and introduce additional operations.
Potential impact
- Arbitrary commands may execute on the GitHub Actions runner
- Repository or organization secrets could be exposed
- A write-scoped
GITHUB_TOKENcould be misused to modify repository contents or workflows - Attackers could push unauthorized changes or tamper with pull requests
- CI/CD credentials and connected systems could be compromised
- Supply-chain integrity could be weakened through malicious repository changes
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from commands that process untrusted repository metadata.
Common defensive patterns include:
- Use process-spawning APIs that accept executable paths and argument arrays rather than shell command strings
- Treat branch names, pull request references, and other event fields as untrusted input
- Prefer immutable numeric pull request references or validated repository-generated identifiers over branch names where practical
- Apply strict allowlists and schema validation when textual references must be accepted
- Minimize workflow token permissions and avoid exposing secrets to untrusted pull request execution
- Separate untrusted validation jobs from privileged repository automation
- Disable shell execution when a direct process API provides the required functionality
How teams detect issues like this
Detection can include:
- Static analysis for string interpolation or concatenation involving GitHub event fields and calls to
exec, shell runners, or equivalent APIs - Code review checks for
pull_request_targetworkflows that consumehead.ref, titles, labels, or other attacker-influenced fields - Policy rules requiring argument-array process APIs for external command execution
- Workflow audits for secrets or write-scoped tokens being available to jobs triggered by forkable pull requests
- Monitoring for unexpected runner commands, secret access, repository pushes, or workflow-file changes
- Automated security review tools that flag shell construction from untrusted inputs

