Skip to navigation

Threat reportVulnerabilityTL-2026-1206

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

criticalPATCHED

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.

Key facts

IdentifiersTL-2026-1206, CVE-2026-12537, CVE-2026-26268
Also known asGHSA-wpqr-6v78-jr5g, GHSA-jj69-4grx-fqj5, Gemini CLI Workspace Trust Bypass RCE
SeverityCRITICAL
CVSS10 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H)
EPSSCVE-2026-26268: 0.4% (35.4th percentile); CVE-2026-12537: 0.2% (10.5th percentile)
Affected productsGoogle @google/gemini-cli; Google google-github-actions/run-gemini-cli; Anysphere Cursor IDE
Weaknesses (CWE)CWE-20, CWE-77, CWE-78, CWE-200, CWE-284, CWE-266
ToolsGemini CLI, run-gemini-cli GitHub Action
MITRE ATT&CK techniquesT1005 Data from Local System, T1059 Command and Scripting Interpreter, T1059.004 Unix Shell, T1082 System Information Discovery, T1140 Deobfuscate/Decode Files or Information, T1195 Supply Chain Compromise, T1195.002 Compromise Software Supply Chain, T1199 Trusted Relationship, T1203 Exploitation for Client Execution, T1211 Exploitation for Stealth, T1528 Steal Application Access Token, T1546 Event Triggered Execution and 7 more in the attack flow
MotivationUNKNOWN
Target sectorstechnology, software-development, devops
Target regionsGlobal
Detection rules9 (1 shown free)
Sources7 cited sources

Detection coverage

As of 2026-07-11, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-1206 across Splunk SPL, Microsoft KQL and Sigma, covering 23 indicator(s) of compromise. The whole corpus is readable without an account. Every threat comes with one complete detection in Splunk SPL, Microsoft KQL and Sigma, free for everyone; a free account adds daily TL Creds to unlock the rest. Paid plans add a larger daily allowance, correlation and the MCP server. Threadlinqs MCP server · View plans.

Free detection: Malicious .gemini/.env Delivered via PR Checkout on CI Runner

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

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

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

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. Sign up free to unlock the detection rules or query them with the Threadlinqs MCP server (Purple)
  • External-Contributor PR Introduces .gemini Config Files · unlock with TL Creds
  • Vulnerable Gemini CLI / run-gemini-cli Action Version in Use Without Trust Gate · unlock with TL Creds
  • Anomalous Outbound Connection from Gemini CLI Process Tree to Non-Allowlisted Host · unlock with TL Creds
  • Gemini CLI [indicator] Written Outside Interactive Session · unlock with TL Creds
  • Gemini CLI Invoked with [indicator] on Headless CI Runner · unlock with TL Creds
  • CI Runner Process Spawns Shell Immediately After Gemini CLI PR-Triggered Run · unlock with TL Creds
  • Gemini CLI Invoked with [indicator] Bypassing Tool Allowlist on Headless Runner · unlock with TL Creds
  • Post-Sandbox-Escape Credential Read and Outbound Exfiltration from Gemini CLI Process Tree · unlock with TL Creds

Indicators of compromise

As of 2026-07-11, Threadlinqs Intelligence tracks 23 indicators of compromise for TL-2026-1206.

23 indicators of compromise · unlock with TL Creds. Compare plans

Technical analysis

No active exploitation or public PoC has been reported.

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 techniques by tactic:

Collection

T1005 Data from Local System

Execution

T1059 Command and Scripting Interpreter; T1059.004 Unix Shell; T1203 Exploitation for Client Execution

Discovery

T1082 System Information Discovery

Defense Evasion

T1140 Deobfuscate/Decode Files or Information; T1211 Exploitation for Stealth

Initial Access

T1195 Supply Chain Compromise; T1195.002 Compromise Software Supply Chain; T1199 Trusted Relationship

Credential Access

T1528 Steal Application Access Token; T1552.001 Credentials In Files; T1555 Credentials from Password Stores

Persistence

T1546 Event Triggered Execution; T1546.001 Change Default File Association

privilege-escalation

T1548 Abuse Elevation Control Mechanism

Lateral Movement

T1550 Use Alternate Authentication Material

Exfiltration

T1567 Exfiltration Over Web Service

Privilege Escalation

T1611 Escape to Host

Remediation

Patches

  • @google/gemini-cli 0.39.1
  • @google/gemini-cli 0.40.0-preview.3
  • google-github-actions/run-gemini-cli 0.1.22

Immediate actions

  • Upgrade @google/gemini-cli to 0.39.1 or 0.40.0-preview.3 or later
  • Upgrade google-github-actions/run-gemini-cli GitHub Action to 0.1.22 or later
  • Audit all CI/CD pipelines that invoke Gemini CLI against untrusted pull-request content for implicit workspace-trust assumptions
  • Inventory any other agentic coding CLIs/IDE extensions (e.g., Cursor) in the environment for equivalent workspace-trust or extension-isolation weaknesses

Workarounds

  • Only set GEMINI_TRUST_WORKSPACE=true for repositories/workflows that do not process untrusted external content
  • Configure and enforce a strict tool allowlist in ~/.gemini/settings.json and confirm it is honored even when --yolo is used
  • Pin the run-gemini-cli Action to a patched tag rather than a floating major-version reference

Longer-term hardening

  • Never run headless/non-interactive agentic CLI tooling against unreviewed external pull requests without an explicit trust gate
  • Enforce least-privilege scoped tokens (short-lived, narrowly-scoped GITHUB_TOKEN) for any workflow that processes untrusted content
  • Treat AI coding-agent CLIs and their CI integrations as part of the software supply chain attack surface and subject them to the same review as build tooling
  • Monitor for anomalous outbound network activity or secret access from CI runners immediately following PR-triggered agent invocations
  • Restrict AI IDE agents from autonomously executing git operations (clone/checkout) against untrusted or unreviewed repositories

Affected and fixed versions

  • Google — @google/gemini-cli
    Vulnerable versions: < 0.39.1; 0.40.0-preview.2
    Fixed in: 0.39.1; 0.40.0-preview.3
  • Google — google-github-actions/run-gemini-cli
    Vulnerable versions: < 0.1.22
    Fixed in: 0.1.22
  • Anysphere — Cursor IDE
    Vulnerable versions: versions prior to git post-checkout hook fix (CVE-2026-26268)
    Fixed in: patched release, February 2026 disclosure window

Timeline

  • Novee Security researcher Assaf Levkovich discloses CVE-2026-26268 (CVSS 8.1), a Cursor IDE git post-checkout hook code-execution flaw triggered when an AI agent autonomously runs git operations against an untrusted cloned repository; reported alongside CVE-2026-12537 as part of the same wave of agentic-tooling CI/IDE trust-boundary findings.
  • Google publishes GHSA-wpqr-6v78-jr5g documenting CVE-2026-12537, a CVSS 10.0 workspace-trust and tool-allowlist bypass RCE affecting @google/gemini-cli and run-gemini-cli, with patched versions 0.39.1 / 0.40.0-preview.3 / 0.1.22 released alongside disclosure.
  • GitHub Security Advisory GHSA-wpqr-6v78-jr5g is updated one day after initial publication with refined technical detail.
  • The Hacker News and CSO Online report on the CVSS-10 Gemini CLI CI RCE alongside related Cursor IDE vulnerabilities (CVE-2026-26268 git-hook sandbox-escape RCE and the unpatched 'CursorJacking' extension access-control flaw documented by LayerX researcher Roy Paz), framing all three as part of a broader agentic-coding-tool trust-boundary problem.
  • Novee Security publishes independent technical analysis of the Gemini CLI RCE, crediting researcher Elad Meged and noting the flaw allowed malicious configuration to load and execute before sandbox initialization.
  • Novee Security's article is updated to incorporate additional findings from Dan Lisichkin of Pillar Security regarding the --yolo tool-allowlisting bypass.
  • Cyber Security News, GBHackers, and Cyberpress republish coverage of CVE-2026-12537, reiterating the CVSS 10.0 severity, affected version ranges, and remediation guidance for CI/CD operators.
  • As of this research pass, CVE-2026-12537 does not appear in the CISA Known Exploited Vulnerabilities catalog and no public exploitation or PoC has been documented; the flaw remains classified as theoretical/disclosed-and-patched.

Sources cited

Previous and next in vulnerability

Drafted by the Threadlinqs research pipeline from 7 sources; published ; last updated —.

Threadlinqs Intelligence — Real-Time Threat Detection Platform

// threat_feed
$ sort --newest
Showing all threats

Live intelligence console

Threat level

Latest Threats