/

CVE-2026-12537

Severity:

HIGH RISK

(7.8)

OS Command Injection (CWE-78) in Gemini CLI Launcher

CVE-2026-12537

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-20, CWE-78

Impact:

Pre-sandbox Host-level Code Execution

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An OS command injection issue in the container launcher of the Google Gemini CLI and its run-gemini-cli GitHub Action allows untrusted environment configuration to influence shell commands.

On headless CI platforms, a maliciously crafted .gemini/.env file can enable an unprivileged attacker to execute code on the host before sandboxing or isolation is applied.

Affected context

This vulnerability arises in environments where the Google Gemini CLI and the run-gemini-cli GitHub Action are used to launch workloads, particularly on headless CI platforms.

It depends on the presence and parsing of .gemini/.env configuration files that can be modified or supplied by untrusted parties, and on container launch flows that build shell commands from these values before isolation or sandboxing is enforced.

Exploit preconditions

  • Attack surface: CI/container launch workflows driven by Google Gemini CLI or the run-gemini-cli GitHub Action
  • Required access: Ability to create, modify, or control the .gemini/.env file within the project or working directory used by the CI job
  • Trigger point: Execution of the container launcher or related automation that reads .gemini/.env and constructs OS-level commands
  • Why exploitation is possible: Input from .gemini/.env is insufficiently validated (CWE-20) and interpolated into shell commands in an unsafe manner (CWE-78), allowing attacker-controlled data to break out of intended arguments and inject additional commands

Why this happens

The root cause is the improper neutralization of special characters and control structures when user-controllable configuration values are incorporated into OS command lines.

Values from .gemini/.env are treated as trusted and embedded into command strings without robust validation, escaping, or use of safer invocation primitives.

This pattern corresponds to CWE-78 (OS Command Injection), with contributing factors from CWE-20 (Improper Input Validation), where data from configuration files is assumed benign and used directly to influence shell execution context.

Potential impact

  • Execution of arbitrary commands on the CI host prior to sandbox or container isolation
  • Compromise of CI runners, including theft or misuse of build secrets and tokens
  • Tampering with build artifacts, test results, or deployment pipelines
  • Lateral movement to other systems reachable from the compromised CI environment
  • Introduction of malicious code into repositories or supply-chain paths

General mitigation guidance

Effective mitigation focuses on reducing trust in configuration inputs and eliminating direct shell interpolation of user-controlled data.

Common defensive patterns include:

  • Avoiding shell-based command construction; instead, using APIs or subprocess invocation with argument arrays that do not require manual quoting
  • Applying strict validation and whitelisting on values read from .gemini/.env, constraining them to expected formats and ranges
  • Normalizing and sanitizing any configuration-derived strings before they influence OS command lines or environment variables
  • Designing CI and container launch flows so that configuration files come from controlled, reviewed sources and are not writable by untrusted actors
  • Running CI jobs and launchers with least-privilege accounts and isolating them from sensitive host resources, reducing the blast radius if misconfiguration occurs

How teams detect issues like this

Detection typically combines code-level analysis with CI configuration review.

Helpful approaches include:

  • Static analysis rules that flag string concatenation or interpolation used to build shell commands from configuration or environment values
  • Code review checklists that call out any use of shell interpreters, system-like calls, or generic subprocess wrappers receiving raw strings
  • Repository policies that restrict or audit modifications to .gemini/.env and similar configuration artifacts, especially in shared CI environments
  • Automated security tooling in CI that scans launcher scripts and workflows for command injection patterns and unvalidated configuration usage

Sources

SourceLink
github.comgithub.com/google-github-actions/run-gemini-cli/security/advisories/GHSA-wpqr-6v78-jr5g

Frequently asked

questions

Exploitability is typically limited to environments where attackers can influence or control the .gemini/.env file used by the Gemini CLI or GitHub Action; when that file is tightly controlled in a private CI pipeline, the risk is reduced.

An attacker generally needs write access to the project workspace or repository supplying .gemini/.env, such as via a pull request, compromised developer account, or controlled fork integrated into CI.

The most robust fix is to remove shell-based interpolation of configuration values and instead use parameterized process execution, combined with strict validation and whitelisting of any configuration fields that affect command behavior.

Future designs should assume configuration files may be attacker-controlled, avoid constructing shell commands from raw strings, enforce rigorous validation on all external inputs, and integrate security-focused code reviews and automated checks into the development lifecycle.

Find out what's already
exploitable in your codebase.