CVE-2026-50187

Description

A flaw was found in the dotenv plugin of Oh My Zsh. A remote attacker could craft a malicious .env file containing arbitrary shell commands. When a user changes into a directory containing this file, the dotenv plugin processes it, leading to the execution of these commands with the user's privileges. This vulnerability allows for arbitrary code execution.

Statement

This is an Important arbitrary code execution flaw in the dotenv plugin of Oh My Zsh. The vulnerability allows an attacker to execute arbitrary shell commands with the user's privileges when a user navigates into a directory containing a specially crafted .env file.

Mitigation

To mitigate this issue, disable the `dotenv` plugin in Oh My Zsh if it is not explicitly required. This can be achieved by removing `dotenv` from the `plugins` array in the `~/.zshrc` file. Alternatively, ensure that `ZSH_DOTENV_PROMPT` is not set to `false` to require explicit user confirmation before sourcing `.env` files, and exercise caution when changing directories into untrusted locations. After modifying `~/.zshrc`, restart the Zsh session for changes to take effect.

Common Vulnerability Scoring System (CVSS) Score Details

Info alert:Important note

CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).

The following CVSS metrics and score provided are preliminary and subject to review.

CVSS v3 Score Breakdown

Red HatNVDcve.org
Base Score8.8N/A8.8
Attack VectorNetworkN/ANetwork
Attack ComplexityLowN/ALow
Privileges RequiredNoneN/ANone
User InteractionRequiredN/ARequired
ScopeUnchangedN/AUnchanged
ConfidentialityHighN/AHigh
Integrity ImpactHighN/AHigh
Availability ImpactHighN/AHigh

Vector

Red Hat: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

cve.org: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Understanding the Weakness (CWE)

Confidentiality,Integrity,Availability,Non-Repudiation

Technical Impact: Execute Unauthorized Code or Commands; DoS: Crash, Exit, or Restart; Read Files or Directories; Modify Files or Directories; Read Application Data; Modify Application Data; Hide Activities

Attackers could execute unauthorized operating system commands, which could then be used to disable the product, or read and modify data for which the attacker does not have permissions to access directly. Since the targeted application is directly executing the commands instead of the attacker, any malicious activities may appear to come from the application or the application's owner.

Frequently Asked Questions

Want to get errata notifications? Sign up here.