CVE-2026-12537: Gemini CLI Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-wpqr-6v78-jr5g
CVSS 10.0
CWE-78 CWE-20 CWE-200 CWE-77
Published
Advisory Summary

CVE-2026-12537 is a CRITICAL (CVSS 10.0) remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Gemini CLI libraries in the npm ecosystem. The issue involves remote code execution via workspace trust and tool allowlisting bypasses. Remediation is available by upgrading affected packages to version 0.39.1, 0.40.0-preview.3, 0.1.22.

CVE-2026-12537 at a Glance

CVE Identifier CVE-2026-12537
GHSA Identifier GHSA-wpqr-6v78-jr5g
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Gemini CLI
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 10.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-12537

To remediate this vulnerability, upgrade all affected Gemini CLI dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@google/gemini-cli fixed: 0.39.1
npm install @google/gemini-cli@0.39.1
@google/gemini-cli fixed: 0.40.0-preview.3
npm install @google/gemini-cli@0.40.0-preview.3
google-github-actions/run-gemini-cli fixed: 0.1.22
Upgrade google-github-actions/run-gemini-cli to 0.1.22
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @google/gemini-cli

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-12537, inspect your project dependencies using npm:

npm ls @google/gemini-cli

Analyze the terminal output to locate any version of Gemini CLI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.39.1), your application is affected.

Note: The npm ls @google/gemini-cli command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Gemini CLI, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# Summary Gemini CLI (`@google/gemini-cli`) and the `run-gemini-cli` GitHub Action are being updated to harden workspace trust and tool allowlisting, in particular when used in untrusted environments like GitHub Actions. This update introduces a breaking change to how non-interactive (headless) environments handle folder trust, which may impact existing CI/CD workflows under specific conditions. # Details Folder Trust in Headless Mode In previous versions, Gemini CLI running in CI environments (headless mode) automatically trusted workspace folders for the purpose of loading configuration and environment variables. This is potentially risky in situations where Gemini CLI runs on untrusted folders in headless mode (e.g. CI workflows that review user-submitted pull requests). If used with untrusted directory contents, this could lead to remote code execution via malicious environment variables in the local `.gemini/` directory. To ensure consistency and user control, the latest update aligns headless mode behavior with interactive mode, requiring folders to be explicitly trusted before configuration files (such as `.env`) are processed. As a result of this change, GitHub Actions and other automated pipelines that rely on the previous automatic trust behavior will fail to load workspace-specific settings until they are updated to use explicit trust mechanisms. Tool Allowlisting under \--yolo In previous versions, when Gemini CLI was configured to run in `--yolo` mode, it would ignore any fine grained tool allowlist in `~/.gemini/settings.json` (e.g. `run_shell_command(echo)` would allow any command). This is potentially risky in situations where Gemini CLI runs on untrusted inputs with `--yolo` (e.g. CI workflows that triage user-submitted GitHub issues where we recommend a strict allowlist). If used with untrusted content and a tool allowlist that permits `run_shell_command`, this could lead to remote code execution via prompt injection. In version `0.39.1`, the Gemini CLI policy engine now evaluates tool allowlisting under `--yolo` mode, which is useful for CI workflows that allowlist a few safe commands to run when processing untrusted inputs. As a result, some workflows that previously depended on this behavior may fail silently unless tool allowlists are modified to fit the task. # Impact This impact is limited to workflows using Gemini CLI in headless mode. Any use of Gemini CLI in headless mode without folder trust will require manual review to correctly configure folder trust. **This affects all Gemini CLI GitHub Actions.** Users must review their workflows, and take one of two approaches: 1\. If the workflow runs on trusted inputs (e.g. reviewing PRs from trusted collaborators), set `GEMINI_TRUST_WORKSPACE: 'true'` in your workflow. 2\. If the workflow runs on untrusted inputs, review our guidance in [google-github-actions/run-gemini-cli](https://github.com/google-github-actions/run-gemini-cli) to harden your workflow against malicious content, and set the environment variable. # Patches The folder trust and tool allowlisting mitigations are available in `@google/gemini-cli` version `0.39.1` and `0.40.0-preview.3`. By default, the `run-gemini-cli` GitHub Action will receive and run the latest version of `gemini-cli`. However, if your workflow specifies a version of `gemini-cli` by setting the [gemini\_cli\_version](https://github.com/google-github-actions/run-gemini-cli#user-content-__input_gemini_cli_version), you are encouraged to upgrade to one of the patched versions and audit the workflow settings that use Gemini CLI. # Credits Gemini thanks the following security researchers for reporting this issue through the Vulnerability Rewards Program (g.co/vulnz): * Elad Meged, Novee Security * Dan Lisichkin, Pillar Security research team

CVE-2026-12537 Affected Gemini CLI Versions

3 component(s)
Fixed Versions:
0.39.10.40.0-preview.30.1.22
Product / Package Ecosystem Affected Versions Fixed Version
@google/gemini-cli
npm
< 0.39.1
0.39.1
@google/gemini-cli
npm
≥ 0.40.0-preview.2
< 0.40.0-preview.3
All 1 versions
0.40.0-preview.2
0.40.0-preview.3
google-github-actions/run-gemini-cli
GitHub Actions
< 0.1.22
0.1.22

References

Frequently Asked Questions

What is CVE-2026-12537?
CVE-2026-12537 is a security vulnerability in Gemini CLI involving Remote Code Execution via workspace trust and tool allowlisting bypasses under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Gemini CLI versions are affected?
Affected versions include releases prior to 0.39.1, 0.40.0-preview.3, 0.1.22 across affected packages: @google/gemini-cli, google-github-actions/run-gemini-cli.
What version fixes CVE-2026-12537?
Upgrading to 0.39.1, 0.40.0-preview.3, 0.1.22 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @google/gemini-cli affected?
Yes, @google/gemini-cli is affected in releases prior to 0.39.1, 0.40.0-preview.3. Upgrade your dependency to 0.39.1, 0.40.0-preview.3 or later.
Is google-github-actions/run-gemini-cli affected?
Yes, google-github-actions/run-gemini-cli is affected in releases prior to 0.1.22. Upgrade your dependency to 0.1.22 or later.
What is the CVSS score of CVE-2026-12537?
CVE-2026-12537 has a CVSS v3.1 base score of 10.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-12537?
CVE-2026-12537 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-12537?
Run the dependency tree command: 'npm ls @google/gemini-cli'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wpqr-6v78-jr5g",
  "modified" : "2026-09-24T20:05:52Z",
  "published" : "2026-04-24T19:30:01Z",
  "aliases" : [ "CVE-2026-12537" ],
  "summary" : "Gemini CLI: Remote Code Execution via workspace trust and tool allowlisting bypasses",
  "details" : "# Summary\n\nGemini CLI (`@google/gemini-cli`) and the `run-gemini-cli` GitHub Action are being updated to harden workspace trust and tool allowlisting, in particular when used in untrusted environments like GitHub Actions. This update introduces a breaking change to how non-interactive (headless) environments handle folder trust, which may impact existing CI/CD workflows under specific conditions.\n\n# Details\n\nFolder Trust in Headless Mode\n\nIn previous versions, Gemini CLI running in CI environments (headless mode) automatically trusted workspace folders for the purpose of loading configuration and environment variables. This is potentially risky in situations where Gemini CLI runs on untrusted folders in headless mode (e.g. CI workflows that review user-submitted pull requests). If used with untrusted directory contents, this could lead to remote code execution via malicious environment variables in the local `.gemini/` directory.\n\nTo ensure consistency and user control, the latest update aligns headless mode behavior with interactive mode, requiring folders to be explicitly trusted before configuration files (such as `.env`) are processed.\n\nAs a result of this change, GitHub Actions and other automated pipelines that rely on the previous automatic trust behavior will fail to load workspace-specific settings until they are updated to use explicit trust mechanisms.\n\nTool Allowlisting under \\--yolo\n\nIn previous versions, when Gemini CLI was configured to run in `--yolo` mode, it would ignore any fine grained tool allowlist in `~/.gemini/settings.json` (e.g. `run_shell_command(echo)` would allow any command). This is potentially risky in situations where Gemini CLI runs on untrusted inputs with `--yolo` (e.g. CI workflows that triage user-submitted GitHub issues where we recommend a strict allowlist). If used with untrusted content and a tool allowlist that permits `run_shell_command`, this could lead to remote code execution via prompt injection.\n\nIn version `0.39.1`, the Gemini CLI policy engine now evaluates tool allowlisting under `--yolo` mode, which is useful for CI workflows that allowlist a few safe commands to run when processing untrusted inputs. As a result, some workflows that previously depended on this behavior may fail silently unless tool allowlists are modified to fit the task.\n\n# Impact\n\nThis impact is limited to workflows using Gemini CLI in headless mode. Any use of Gemini CLI in headless mode without folder trust will require manual review to correctly configure folder trust. **This affects all Gemini CLI GitHub Actions.** Users must review their workflows, and take one of two approaches:\n\n1\\. If the workflow runs on trusted inputs (e.g. reviewing PRs from trusted collaborators), set `GEMINI_TRUST_WORKSPACE: 'true'` in your workflow.\n\n2\\. If the workflow runs on untrusted inputs, review our guidance in [google-github-actions/run-gemini-cli](https://github.com/google-github-actions/run-gemini-cli) to harden your workflow against malicious content, and set the environment variable.\n\n# Patches\n\nThe folder trust and tool allowlisting mitigations are available in `@google/gemini-cli` version `0.39.1` and `0.40.0-preview.3`.  By default, the `run-gemini-cli` GitHub Action will receive and run the latest version of `gemini-cli`. However, if your workflow specifies a version of `gemini-cli` by setting the [gemini\\_cli\\_version](https://github.com/google-github-actions/run-gemini-cli#user-content-__input_gemini_cli_version), you are encouraged to upgrade to one of the patched versions and audit the workflow settings that use Gemini CLI.\n\n# Credits\n\nGemini thanks the following security researchers for reporting this issue through the Vulnerability Rewards Program (g.co/vulnz):\n\n* Elad Meged, Novee Security\n* Dan Lisichkin, Pillar Security research team",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@google/gemini-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.39.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@google/gemini-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.40.0-preview.2"
      }, {
        "fixed" : "0.40.0-preview.3"
      } ]
    } ],
    "versions" : [ "0.40.0-preview.2" ]
  }, {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "google-github-actions/run-gemini-cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.22"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/google-github-actions/run-gemini-cli/security/advisories/GHSA-wpqr-6v78-jr5g"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-12537"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/google-github-actions/run-gemini-cli"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-200", "CWE-77", "CWE-78" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-24T19:30:01Z",
    "nvd_published_at" : null
  }
}