# Critical Gemini CLI Vulnerability (CVE-2026-12537) Enables Remote Code Execution via Malicious .env Workspace Trust Bypass

> CVE-2026-12537 (CVSS 10.0) in @google/gemini-cli (< 0.39.1, = 0.40.0-preview.2) and the google-github-actions/run-gemini-cli GitHub Action (< 0.1.22) allows an unauthenticated attacker to achieve pre-sandbox, host-level remote code execution on headless CI platforms by planting a malicious .gemini/.env file in a pull request, exploiting automatic workspace-trust and a --yolo tool-allowlist bypass. No active exploitation or public PoC has been reported.

- **Published:** 2026-07-11T00:00:00Z
- **Last reviewed:** 2026-07-11T00:00:00Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-1206
- **Card image:** https://intel.threadlinqs.com/og/threat/threat-intel-gemini-cli-workspace-trust-rce-tl-2026-1206.webp?v=9d1b56f5 (Threadlinqs threat intel: CVE-2026-12537 Gemini CLI Trust Bypass: Detection & IOCs (TL-2026-1206) — Critical severity, 23 IOCs, 9 detection rules.)
- **ID:** TL-2026-1206
- **Severity:** CRITICAL (CVSS 10)
- **Category:** VULNERABILITY
- **Status:** PATCHED
- **Detections:** 9 (1 shown free below) · **IOCs:** 23
- **CVEs:** CVE-2026-12537, CVE-2026-26268

## Description

Google's Gemini CLI and its companion run-gemini-cli GitHub Action are widely used to run the Gemini agent inside CI/CD pipelines for tasks such as automated pull-request review, triage, and code generation. GHSA-wpqr-6v78-jr5g (CVE-2026-12537) documents two compounding design flaws that together allow an unprivileged external attacker to force their own malicious content to load as trusted Gemini configuration and execute arbitrary OS commands on the CI host before the agent's sandbox is even initialized.

First, in headless/non-interactive mode (the mode CI runners use), the CLI automatically trusted the workspace folder without any explicit user confirmation. This meant configuration and environment files under a repository's .gemini/ directory -- most critically .gemini/.env -- were parsed and loaded as legitimate local configuration with no verification that the repository content was trustworthy. An attacker who can get a pull request processed by the pipeline (e.g., an external contributor opening a PR against a public repo that runs Gemini-CLI-based PR review) can therefore smuggle a crafted .gemini/.env file containing attacker-controlled environment variables and command payloads into the CI job.

Second, the --yolo convenience flag -- intended to let trusted operators skip per-tool confirmation prompts -- was found to also silently bypass the fine-grained tool-execution allowlist defined in ~/.gemini/settings.json. Where a pipeline operator believed they had constrained the agent to a narrow set of safe tools, --yolo mode ignored that allowlist and permitted unrestricted shell command execution, compounding the impact of the workspace-trust bypass.

Chained together, these flaws let a malicious .gemini/.env entry execute attacker-controlled commands on the underlying CI host with the privileges of the pipeline job -- prior to any sandbox restriction taking effect -- yielding read access to repository secrets (e.g., GITHUB_TOKEN), build artifacts, and adjacent CI infrastructure, and potentially enabling credential theft, repository push access, and downstream supply-chain compromise of published packages or containers. The vulnerability was independently discovered and reported through Google's Vulnerability Rewards Program by Elad Meged of Novee Security and Dan Lisichkin of Pillar Security. Google published the GHSA advisory on 2026-04-24 (updated 2026-04-25) and shipped fixes (gemini-cli 0.39.1 / 0.40.0-preview.3; run-gemini-cli Action 0.1.22) removing implicit workspace trust in headless mode and enforcing the tool allowlist even under --yolo. As of disclosure, no evidence of in-the-wild exploitation or public proof-of-concept exists, and the CVE is not present in the CISA KEV catalog.

Coverage of this disclosure consistently grouped it with a wider wave of AI coding-agent CI/CD and IDE vulnerabilities reported in the same window, most notably two flaws in Anysphere's Cursor IDE: CVE-2026-26268 (CVSS 8.1), a git post-checkout hook execution issue reported by Novee Security researcher Assaf Levkovich and disclosed February 2026, in which an AI agent autonomously running `git checkout` inside an untrusted cloned repository silently triggers a malicious post-checkout hook and achieves code execution without explicit user awareness; and 'CursorJacking' (CVSS 8.2, unpatched at time of reporting), documented by LayerX researcher Roy Paz, in which Cursor fails to enforce access-control boundaries between installed extensions and local SQLite-based credential storage, letting any extension with filesystem access exfiltrate API keys and session tokens. These related disclosures illustrate a broader pattern of agentic coding tools inheriting host-level trust and execution privileges that traditional IDEs and CI runners did not extend to untrusted repository content, and are documented here as directly relevant context for the Gemini CLI finding rather than as the primary subject of this record.

## MITRE ATT&CK

- T1195 Supply Chain Compromise
- T1195.002 Compromise Software Supply Chain
- T1199 Trusted Relationship
- T1059 Command and Scripting Interpreter
- T1059.004 Unix Shell
- T1203 Exploitation for Client Execution
- T1546 Event Triggered Execution
- T1546.001 Change Default File Association
- T1611 Escape to Host
- T1211 Exploitation for Stealth
- T1140 Deobfuscate/Decode Files or Information
- T1548 Abuse Elevation Control Mechanism
- T1552.001 Credentials In Files
- T1555 Credentials from Password Stores
- T1528 Steal Application Access Token
- T1082 System Information Discovery
- T1005 Data from Local System
- T1567 Exfiltration Over Web Service
- T1550 Use Alternate Authentication Material

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**Malicious .gemini/.env Delivered via PR Checkout on CI Runner** (`TL-2026-1206-SPL-001`)

Detects a new or modified .gemini/.env file appearing in a CI runner workspace immediately after a pull_request-triggered checkout, the core CVE-2026-12537 supply-chain delivery step (T1195/T1195.002/T1199).

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1195, T1195.002, T1199
- **Data sources:** sysmon, linux_auditd, github_actions_runner_logs
- **Severity:** critical
- **Confidence:** high

### Splunk SPL

```spl
index=endpoint sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" OR sourcetype="linux:auditd" (EventCode=11 OR type=CREATE) TargetFilename="*/.gemini/.env" earliest=-24h
| eval process_owner=coalesce(User, uid)
| where NOT match(process_owner, "interactive-operator")
| stats count min(_time) as first_seen by host, TargetFilename, process_owner, Image
| where count > 0
| table first_seen, host, TargetFilename, process_owner, Image
```

### Microsoft KQL

```kql
DeviceFileEvents
| where Timestamp > ago(24h)
| where FileName == ".env" and FolderPath has "/.gemini/"
| where InitiatingProcessAccountName !contains "interactive-operator"
| where InitiatingProcessFolderPath has_any ("actions-runner", "gemini")
| project Timestamp, DeviceName, FolderPath, FileName, InitiatingProcessAccountName, InitiatingProcessFileName, InitiatingProcessCommandLine
| summarize count() by DeviceName, FolderPath, InitiatingProcessAccountName
```

### Sigma

```yaml
title: Gemini CLI .gemini/.env Written Outside Interactive Session
id: 8f2b6c1a-1206-4c9e-9a3a-tlintel120601
status: experimental
description: Detects a .gemini/.env file being written to a CI runner workspace outside an interactive operator session, consistent with CVE-2026-12537 PR-delivered workspace-trust bypass
references:
    - https://github.com/advisories/GHSA-wpqr-6v78-jr5g
author: Threadlinqs Team
date: 2026-07-11
tags:
    - attack.initial-access
    - attack.t1195
    - attack.t1195.002
    - attack.t1199
    - cve.2026.12537
logsource:
    category: file_event
    product: linux
detection:
    selection:
        TargetFilename|endswith: '/.gemini/.env'
        Image|contains:
            - 'actions-runner'
            - 'gemini'
    filter:
        ParentUser: 'interactive-operator'
    condition: selection and not filter
falsepositives:
    - Legitimate operator-authored .env in a locally trusted, non-CI workspace
level: high
```

**Known false positives:**

- Legitimate operator-authored .env file committed to a locally trusted, non-CI workspace by a known maintainer

**Tuning notes:** Scope to repositories that run gemini-cli/run-gemini-cli-action against pull_request triggers from forks; exclude paths under known trusted internal-only workspaces; correlate with PR author reputation (first-time contributor) to reduce noise.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- External-Contributor PR Introduces .gemini Config Files (locked: unlock with TL Creds)
- Vulnerable Gemini CLI / run-gemini-cli Action Version in Use Without Trust Gate (locked: unlock with TL Creds)
- Anomalous Outbound Connection from Gemini CLI Process Tree to Non-Allowlisted Host (locked: unlock with TL Creds)
- Gemini CLI [indicator] Written Outside Interactive Session (locked: unlock with TL Creds)
- Gemini CLI Invoked with [indicator] on Headless CI Runner (locked: unlock with TL Creds)
- CI Runner Process Spawns Shell Immediately After Gemini CLI PR-Triggered Run (locked: unlock with TL Creds)
- Gemini CLI Invoked with [indicator] Bypassing Tool Allowlist on Headless Runner (locked: unlock with TL Creds)
- Post-Sandbox-Escape Credential Read and Outbound Exfiltration from Gemini CLI Process Tree (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sources

- [Critical Gemini CLI Vulnerability Lets Attackers Execute Arbitrary Code](https://cybersecuritynews.com/critical-gemini-cli-vulnerability/)
- [Critical Google Gemini CLI Flaw Lets Attackers Execute Code on Headless CI Platforms](https://gbhackers.com/critical-google-gemini-cli-flaw/)
- [Critical Gemini CLI Vulnerability Exposes CI Workflows to Command Injection Attacks](https://cyberpress.org/critical-gemini-cli-vulnerability/)
- [Google Fixes CVSS 10 Gemini CLI CI RCE and Cursor Flaws Enable Code Execution](https://thehackernews.com/2026/04/google-fixes-cvss-10-gemini-cli-ci-rce.html)
- [Max-severity RCE flaw found in Google Gemini CLI](https://www.csoonline.com/article/4165470/max-severity-rce-flaw-found-in-google-gemini-cli.html)
- [GHSA-wpqr-6v78-jr5g: Gemini CLI workspace trust and tool allowlist bypass RCE](https://github.com/advisories/GHSA-wpqr-6v78-jr5g)
- [CVE-2026-12537 | THREATINT](https://cve.threatint.eu/CVE/CVE-2026-12537)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-1206
