Summary
wenxian's GitHub Actions workflow processes untrusted issue comments directly in a shell command, enabling command injection on the CI runner.
An attacker who can post crafted comments to the repository's issues may execute arbitrary commands with the runner's privileges during workflow runs.
Affected context
The vulnerability appears in the project's GitHub Actions automation, not in the wenxian CLI tool itself.
It affects repositories that use the vulnerable workflow configuration, where a workflow is triggered by issue comments and interpolates the raw issue_comment.body into a shell command.
The risk is present when the workflow runs on GitHub-hosted or self-hosted runners with permissions or secrets that would be valuable if compromised.
Exploit preconditions
- Attack surface: GitHub repository issue comment interface (web UI, API, or any integration that can post comments).
- Required access: Ability to create or modify issue comments in a repo where the vulnerable workflow is enabled. This may include unauthenticated users in public repositories or any authenticated collaborator, depending on repository settings and workflow permissions.
- Trigger point: A workflow run that reads
issue_comment.bodyand concatenates it into a shell command line (e.g., viarun:steps,bash -c, or similar). - Why exploitation is possible: The workflow treats untrusted text from issue comments as part of a shell command without proper quoting, escaping, or contextual sanitization, allowing the attacker to break out of the intended argument and inject arbitrary shell syntax.
Why this happens
The core bug is the direct inclusion of untrusted user input in a command executed by a shell in a GitHub Actions workflow.
This maps to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') and is closely related to CWE-78: Improper Neutralization of Special Elements used in an OS Command.
Instead of treating issue_comment.body as data and passing it as a constrained argument, the workflow composes a command string where shell metacharacters (such as ;, &&, |, backticks, or $()) are interpreted by the shell.
In the CI/CD context, this pattern is particularly dangerous because the workflow may have access to repository contents, tokens, or deployment credentials, all of which become reachable if the shell is subverted.
Potential impact
- Execution of arbitrary commands on the GitHub Actions runner.
- Theft or misuse of repository secrets, tokens, or credentials available to the workflow.
- Unauthorized modification or exfiltration of repository contents and artifacts.
- Tampering with generated BIBTEX files or other build outputs consumed downstream.
- Lateral movement into other systems that the CI pipeline can reach (e.g., artifact stores, registries, staging environments).
- Abuse of compute resources for malicious activities such as cryptomining or hosting malware.
General mitigation guidance
Effective mitigation focuses on treating all workflow-supplied user input as untrusted and eliminating direct shell interpolation:
- Prefer data-driven actions: use official GitHub Actions or scripts that accept data via inputs or environment variables rather than building shell command strings from user content.
- If shell commands are unavoidable, ensure strict quoting and escaping and avoid passing raw user input to the shell; use positional arguments instead of
bash -c "…$USER_INPUT…". - Apply input validation and filtering in the workflow logic, allowing only expected patterns (e.g., restricted identifier formats like DOI/PMID/arXiv IDs), and reject or neutralize any unexpected characters or structures.
- Minimize workflow privileges: use least-privilege tokens, disable unnecessary permissions, and avoid granting workflows wide-ranging repository or environment access.
- Isolate risky jobs: run them in constrained environments with no secrets and minimal network and filesystem access, so even if input handling fails, the blast radius is limited.
- Document security assumptions around automation that ingests community input, so future workflows avoid repeating the pattern.
How teams detect issues like this
Detection involves both code-centric and pipeline-centric reviews:
- Workflow configuration review: Examine
.github/workflows/*.ymlforrun:steps that concatenate values likegithub.event.comment.body,issue_comment.body, or other user-controlled fields into shell commands. - Static analysis: Apply rules that flag shell invocations with untrusted inputs, especially where interpolation occurs inside
"..."or'...'inrun:blocks or scripts. - Policy enforcement: Use repository governance (branch protection, code owners, mandatory security review for workflow changes) to ensure that new or modified workflows with shell execution receive explicit scrutiny.
- Runtime monitoring: Review GitHub Actions logs for suspicious patterns, such as unexpected command sequences or failed steps that include suspicious user-generated content.
- Automated tooling: Integrate security scanners that understand GitHub Actions semantics and can identify injection-prone constructs in workflow YAML and related scripts.

