# Gemini CLI GitHub Actions RCE (CVE-2026-85259)

> Source: <https://blog.ostorlab.co/gemini-cli-github-actions-rce-cve-2026-85259.html>
> Published: 2026-12-01 23:20:00+00:00

**Recommendation:** Pin `run-gemini-cli` to a full commit SHA from 2026-05-12 or later, disable persisted checkout credentials and restrict shell tools on issue-triggered workflows, then rotate `GEMINI_API_KEY` and `APP_PRIVATE_KEY`.
More in the playbook "Securing agents and AI tools": <https://wpnews.pro/playbooks/agent-security>

[Deep Dive](https://blog.ostorlab.co/category/deep-dive.html)

# Gemini CLI GitHub Actions RCE (CVE-2026-85259)

Gemini CLI issue workflows before 2026-05-12 could let crafted issue input execute commands. Review these workflows, permissions and credential exposure.

## TL;DR

- Gemini CLI's automated issue-triage workflows passed the issue title and body to a shell-capable agent. A crafted issue could run commands on the GitHub Actions runner. Google published CVE-2026-85259 on 2026-12-01.
- Any public repository running the legacy `run-gemini-cli` triage, review or issue-fixer workflows before 2026-05-12 is exposed. The CLI has 516,442 weekly npm downloads.
- The CVE record rates it CVSS v4.0 10.0 Critical (CWE-78). No public proof of concept and no exploitation are reported, and it is not in CISA KEV as of 2026-12-02.
- Update the action and the CLI to builds from 2026-05-12 or later, set `persist-credentials: false` , restrict shell tools and rotate`GEMINI_API_KEY` and`APP_PRIVATE_KEY` . See "How do I fix it?".

## Am I affected?

You are exposed when all of these conditions hold:

- A workflow uses `google-github-actions/run-gemini-cli` , or the Gemini CLI triage commands, at a revision before 2026-05-12.
- The workflow runs on issue or pull-request text that an outsider can write.
- The agent has a vulnerable path from untrusted input to command execution, including access to shell tools.
- The issue-triggered workflow runs without a maintainer approval gate.

Persisted checkout credentials and other accessible secrets increase the impact; their presence is not required for command execution.

Public repositories are the main exposure. A maintainer can still be attacked through a pull request from a fork, because the workflow runs on text the contributor controls. Private repositories are exposed when a lower-trusted member or an outside collaborator can open issues or pull requests.

The CVE gives a date, not a semantic version. Google fixed the workflows on 2026-05-12, so the table uses that date as the cut-off. The latest CLI release is 0.71.1 from 2026-11-24.

| Component | Affected builds | Fixed builds | 
|---|---|---|
| `run-gemini-cli` GitHub Action | Commits before 2026-05-12 | Commits from 2026-05-12 | 
| `@google/gemini-cli` | Releases before 2026-05-12 | Releases from 2026-05-12; latest 0.71.1 | 
| Triage command templates | `!{echo ...}` interpolation of issue text | Hardened templates plus tool restrictions | 

Find the workflows in a repository:

```
grep -R "run-gemini-cli" .github/workflows
```

Find the issue-triggered commands:

```
grep -R -E "gemini-(triage|scheduled-triage|issue-fixer|invoke)" .github/workflows
```

Check whether the checkout persists the token:

```
grep -R -A6 "actions/checkout" .github/workflows | grep -n "persist-credentials"
```

An empty result means at least one checkout still uses the default, which persists the token in the local Git configuration. Check every workflow that processes untrusted input, not only the first match.

Check the CLI version on the runner:

```
npx @google/gemini-cli --version
```

Check the action reference and its date:

```
grep -R "google-github-actions/run-gemini-cli@" .github/workflows
```

Check whether shell execution is enabled in the workflow settings:

```
grep -R -E "run_shell_command|--yolo|coreTools" .github/workflows .gemini
```

## How do I fix it?

Update the action and the CLI, remove the persisted token, restrict the agent's tools and rotate the secrets. A single change is not enough.

1. Update the CLI to 0.71.1 or later:

```
npm install -g @google/gemini-cli@0.71.1
```

1. 
Update `google-github-actions/run-gemini-cli` to a commit from 2026-05-12 or later. The upstream examples use`@main` , which is not a fixed target. Pin the action to a full commit SHA in the hardened range and record that SHA in the workflow.
2. 
Add `persist-credentials: false` to every`actions/checkout` step in the affected workflows:

```
- uses: actions/checkout@v6
  with:
    persist-credentials: false
```

1. 
Remove `run_shell_command` and`--yolo` from the triage jobs. Keep the GitHub MCP tool allowlist narrow, as the hardened`gemini-invoke` and`gemini-review` examples do.
2. 
Disable or delete the legacy automated triage workflows if you cannot harden them. A maintainer approval gate or a label trigger that only maintainers can apply also removes the anonymous path.
3. 
Rotate `GEMINI_API_KEY` ,`APP_PRIVATE_KEY` ,`GOOGLE_API_KEY` and every other secret that was present on a runner that executed a vulnerable workflow. Removing the workflow does not revoke a token that was already read.

`persist-credentials: false` prevents checkout from persisting its credential. Commands may still use other available credentials, including `GITHUB_TOKEN`; restrict tools and permissions and require approval for untrusted input.

If you cannot upgrade, the workaround is to stop running the agent on untrusted input:

1. Disable the `issues` and`pull_request` triggers on the Gemini workflows.
2. Run the triage only from a `workflow_dispatch` event that a maintainer starts.
3. Keep the checkout's `persist-credentials` at`false` and scope`GITHUB_TOKEN` to`contents: read` .

The workaround limits who can supply input; it does not repair the vulnerable agent execution path. A maintainer must still review the input before starting a manual run.

## What is the root cause?

The templates run `!{echo $ISSUE_TITLE}` and `!{echo $ISSUE_BODY}` through the CLI shell processor and append the command output to the model prompt. Ordinary shell expansion does not reparse metacharacters inside those environment values as commands. This ingestion path alone does not establish direct shell injection before the model runs.

```
# .github/commands/gemini-triage.toml
**Issue Title**:
```
!{echo $ISSUE_TITLE}
```

**Issue Body**:
```
!{echo $ISSUE_BODY}
The same pattern appears in the issue fixer, which places the title and body inside an XML context block:

```
# .github/commands/gemini-issue-fixer.toml
<issue>
    <repository>!{echo $REPOSITORY}</repository>
    <number>!{echo $ISSUE_NUMBER}</number>
    <title>!{echo $ISSUE_TITLE}</title>
    <body>!{echo $ISSUE_BODY}</body>
</issue>
```

The workflow passes the issue fields into the job environment, and the checkout keeps the GitHub token by default:

```
# .github/workflows/gemini-issue-fixer.yml
- name: 'Run Gemini PR Create'
  uses: 'google-github-actions/run-gemini-cli@main'
  env:
    GITHUB_TOKEN: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN }}'
    ISSUE_TITLE: '${{ github.event.issue.title }}'
    ISSUE_BODY: '${{ github.event.issue.body }}'
```

The workflow explicitly supplies `GITHUB_TOKEN` to the agent step and passes provider keys as action inputs. `APP_PRIVATE_KEY` is an input to an earlier token-minting step, not an agent environment variable. Exposure depends on credentials and files actually accessible to the affected process.

The CVE confirms command execution and file reading through crafted issue input in legacy workflows. The public record does not provide the exact payload or execution sequence; the template excerpts alone cannot establish it.

## How is it exploited?

1. An attacker submits crafted issue input to an affected legacy workflow.
2. The workflow incorporates that input into the agent prompt.
3. The vulnerable agent/tool path may execute commands with the job’s permissions.
4. Those commands may read accessible files or credentials and use token permissions to modify the repository.

The public advisory does not supply an exact payload. A semicolon or command substitution in an environment value is not, by itself, a demonstrated reproduction.

## How does the attack flow?

Crafted issue input reaches an agent prompt; the vulnerable agent/tool path may execute commands with the job’s permissions.

## What can an attacker do?

An attacker who obtains command execution can access files and credentials available to that process. The workflow explicitly passes `GITHUB_TOKEN`; provider keys are action inputs. The earlier token-minting step’s `APP_PRIVATE_KEY` is not shown in the agent environment. Repository changes require a token with the necessary permissions. The CVE confirms command execution and file reading, without demonstrating every possible downstream impact.

## Why does the fix work?

The linked patches add `persist-credentials: false` to checkout steps. The advisory separately recommends restricting tools. These are distinct controls: checkout hardening prevents checkout from persisting its credential, while tool restrictions reduce what the agent can execute.

```
--- a/.github/workflows/gemini-invoke.yml
+++ b/.github/workflows/gemini-invoke.yml
@@
       - name: 'Checkout Code'
         uses: 'actions/checkout@v4'
         with:
-          # no persist-credentials setting: the token stays in .git/config
+          persist-credentials: 'false'
--- a/.github/workflows/gemini-issue-fixer.yml
+++ b/.github/workflows/gemini-issue-fixer.yml
@@
       - name: 'Checkout repository'
         uses: 'actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8'
         with:
-          # no persist-credentials setting
+          persist-credentials: 'false'
```

The linked patches establish checkout hardening, not removal of shell tools. `persist-credentials: false` does not prevent commands from using another credential, including an explicitly supplied `GITHUB_TOKEN`. Restrict agent tools, minimize token permissions and gate untrusted input.

Rotate credentials according to the advisory and the exposure of affected workflow runs. Do not infer that every job secret was an agent environment variable.

## How do I check if I was compromised?

Start with the workflow runs that handled issues from outside contributors. GitHub records the actor and the event for each run.

List the recent issue-triggered runs:

```
gh run list --event issues --limit 100
```

List the pull-request runs from forks:

```
gh run list --event pull_request --limit 100
```

For a suspect run, download the logs and search for shell syntax in the issue text and for outbound requests:

```
gh run view <run-id> --log > run.log
grep -nE '\$\(|`|;|&&|\|\|' run.log | head -50
```

Search for requests to unfamiliar hosts in the runner log:

```
grep -nE 'https?://' run.log | grep -vE 'github.com|githubusercontent.com|googleapis.com|google.com' | head -50
```

Check the repository's audit log for pushes, branch creations and pull requests by the GitHub App or `github-actions`:

```
gh api /repos/<owner>/<repo>/events --paginate | jq '.[] | select(.actor.login == "github-actions[bot]")'
```

No indicators of compromise are published for this CVE. A command that ran and failed may leave no trace beyond the workflow log, and a token that was read and used elsewhere may leave no entry in this repository. Treat a run on a vulnerable workflow with an untrusted issue as a lead, not as proof.

## Timeline

- 2026-05-11: Pull request 518 merges and aligns more checkout steps with the same setting.
- 2026-05-12: Pull request 26897 merges in the Gemini CLI repository, and Google treats this date as the fix cut-off.
- 2026-12-01: Google publishes CVE-2026-85259 at 20:22 UTC.

## FAQ

**Does the CVE affect the Gemini model or the CLI binary?**
No. It affects the GitHub Actions triage workflows that wrap the CLI and pass issue text to it. The model itself is not the vulnerable component.

**I use the CLI locally. Am I affected?**
No, unless you run one of the affected workflow templates on untrusted issue text. The CVE is scoped to the GitHub Actions triage workflows.

**Is `persist-credentials: false` enough?**
`persist-credentials: false` prevents checkout from persisting its credential. Commands may still use other available credentials, including `GITHUB_TOKEN`; restrict tools and permissions and require approval for untrusted input.

**Do I need to rotate the keys if I never saw an attack?**
Follow the advisory’s rotation guidance for credentials potentially exposed by affected runs. The absence of an observed attack does not establish that accessible credentials were safe.

**Is the latest CLI version fixed?**
The latest release is 0.71.1 from 2026-11-24, which is after the 2026-05-12 cut-off. The workflow files are separate, so update the action and the templates too.

**Can a private repository be attacked?**
Yes, if a lower-trusted member or an outside collaborator can open an issue or a pull request that triggers the workflow. The token and the secrets are the same.

## References

- CVE-2026-85259 record, https://www.cve.org/CVERecord?id=CVE-2026-85259 (checked December 2, 2026)
- GitHub Advisory Database, GHSA-g6vw-c6rx-j9ph, https://github.com/advisories/GHSA-g6vw-c6rx-j9ph (checked December 2, 2026)
- Gemini CLI pull request 26897, checkout hardening, https://github.com/google-gemini/gemini-cli/pull/26897 (checked December 2, 2026)
- run-gemini-cli pull request 518, checkout hardening, https://github.com/google-github-actions/run-gemini-cli/pull/518 (checked December 2, 2026)
- run-gemini-cli issue triage command, https://github.com/google-github-actions/run-gemini-cli/blob/main/.github/commands/gemini-triage.toml (checked December 2, 2026)
- run-gemini-cli issue fixer command, https://github.com/google-github-actions/run-gemini-cli/blob/main/.github/commands/gemini-issue-fixer.toml (checked December 2, 2026)
- run-gemini-cli issue fixer workflow, https://github.com/google-github-actions/run-gemini-cli/blob/main/.github/workflows/gemini-issue-fixer.yml (checked December 2, 2026)
- run-gemini-cli repository, https://github.com/google-github-actions/run-gemini-cli (checked December 2, 2026)
- npm package, @google/gemini-cli, https://www.npmjs.com/package/@google/gemini-cli (checked December 2, 2026)
- CISA Known Exploited Vulnerabilities catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog (checked December 2, 2026)
- Gemini CLI shell processor, https://github.com/google-gemini/gemini-cli/blob/main/packages/cli/src/services/prompt-processors/shellProcessor.ts (checked December 2, 2026)

Keep reading

## Related articles

[Browse the blog](https://blog.ostorlab.co/)
