Code execution via sourced .env files
Published Aug 18, 2026 · Updated Aug 18, 2026
Code injection in the dotenv plugin in the ohmyzsh framework before 2026-05-28 allows attackers to execute shell commands via a malicious .env file. The plugin's chpwd hook loads ZSH_DOTENV_FILE with source after a directory change, and its zsh -fn precheck accepts syntactically valid shell code instead of restricting input to environment-variable assignments. Exploitation requires the dotenv plugin to be enabled and a person to enter a directory containing the file; execution is promptless when ZSH_DOTENV_PROMPT=false and otherwise follows the default empty-Enter acceptance path.
Summary
What happened
Code injection in the dotenv plugin in the ohmyzsh framework before 2026-05-28 allows attackers to execute shell commands via a malicious .env file. The plugin's chpwd hook loads ZSH_DOTENV_FILE with source after a directory change, and its zsh -fn precheck accepts syntactically valid shell code instead of restricting input to environment-variable assignments. Exploitation requires the dotenv plugin to be enabled and a person to enter a directory containing the file; execution is promptless when ZSH_DOTENV_PROMPT=false and otherwise follows the default empty-Enter acceptance path.
The record
- CVE
- CVE-2026-50187
- Published
- Aug 18, 2026
- Updated
- Aug 18, 2026
- Vendor
- Oh My Zsh
- Product
- Oh My Zsh
- Classifications
- CWE-94, T1204.002, T1059.004
- Attack vector
- network
- Privileges
- unauthenticated
Timeline
How it unfolded
- Aug 18, 2026CVE publishedPublication date reported by the CVE source.
- Aug 18, 2026Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
Compare these published version ranges with your installed build and any vendor patches.
- Affected versionversion=< 2026-05-28
What conditions does exploitation require?
What is affected?
Published CVSS scores
CVSS describes severity. EPSS estimates exploitation probability.
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
Public exploit references
- OhMyZsh dotenv Remote Code Executionproof of concept · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo