# CVE-2026-13745: Google Gemini CLI arbitrary code execution via .env override

Source: https://junglewise.ai/threats/cve-2026-13745-google-gemini-cli-arbitrary-code-execution-via-env-override  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-10. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

CVE-2026-13745 · Severity: info · Published 2026-09-10

Gemini CLI is a command-line tool that acts as an AI-powered coding assistant. Prior to version 0.39.1, an attacker can trick a user into running the CLI from a malicious directory containing a .env file that redirects the application's configuration folder, bypassing safety prompts and allowing arbitrary command execution through malicious MCP server configurations.

Technologies: [Google Gemini CLI](https://junglewise.ai/threats/technologies/gemini-cli). Vendors: [Google](https://junglewise.ai/threats/vendors/google).

## Quick answers

**Is CVE-2026-13745 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-13745 being exploited in the wild.

**How severe is CVE-2026-13745?** Informational severity, published 10 September 2026.

**Which products and versions are affected?** Google Gemini CLI prior to 0.39.1.

**Is there a fix for CVE-2026-13745?** A patch was published on 2026-04-24: Fix released in version 0.39.1 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-13745 attacked?** It is attacked with local access.

**Am I affected by CVE-2026-13745?** Check whether you run Google Gemini CLI at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability is a directory traversal / configuration hijacking flaw in how Gemini CLI processes environment variables and configuration files. The root cause is that the GEMINI_CLI_HOME environment variable (read from untrusted .env files in the current working directory) is used to redirect the location of the "trusted" user configuration directory. By placing a malicious .env file and corresponding .gemini/settings.json in an untrusted directory, an attacker can disable the folder trust prompt (via security.folderTrust.enabled = false) and inject malicious MCP server commands that execute with the user's privileges. The attack requires only that a victim launch Gemini CLI from an attacker-controlled or attacker-prepared directory; no user interaction beyond running the tool is needed. The vulnerability was patched in version 0.39.1.

## Affected products

- Google Gemini CLI prior to 0.39.1

## Timeline

- 2026-06-04: disclosed: Vulnerability disclosed on pwned.info
- 2026-04-24: patched: Fix released in version 0.39.1
- 2026-09-10: advisory: CVE-2026-13745 published on NVD

## References

- [https://github.com/google-gemini/gemini-cli/releases/tag/v0.39.1](https://github.com/google-gemini/gemini-cli/releases/tag/v0.39.1)
- [https://www.pwned.info/articles/homing-in-on-arbitrary-code-execution-within-gemini-cli/](https://www.pwned.info/articles/homing-in-on-arbitrary-code-execution-within-gemini-cli/)

## Related threats

- [Google Gemini CLI OS command injection in container launcher](https://junglewise.ai/threats/google-gemini-cli-os-command-injection-in-container-launcher-f7bccc96)
- [Google Gemini CLI OS command injection in headless CI environments](https://junglewise.ai/threats/cve-2026-12537-google-gemini-cli-os-command-injection-in-headless-ci)
