Technical impact
In nvm versions 0.5.0 through 0.40.8 the requested version pattern is forwarded to grep without the -e flag, making it a case of CWE‑88 (Improper Handling of Command-Line Inputs). Thus a .nvmrc file that begins with a hyphen can be interpreted as grep options. The injected grep options, such as -R, cause grep to recursively search the current directory and treat a matched string as a node version. As a result, local files that contain sensitive data—like a repository’s .npmrc that stores an npm token—can be printed to the terminal and written to mirror and proxy logs, leaking credentials without enabling code execution.
Affected Systems
The vulnerable product is nvm from nvm-sh; affected releases include 0.5.0 up through 0.40.8.
Risk and Exploitability
The vulnerability receives a CVSS score of 4.6 indicating moderate severity, has no reported EPSS value, and is not listed in the CISA KEV catalog. Exploitation requires the attacker to supply a .nvmrc file starting with a hyphen in a directory where nvm is executed; the attack is therefore a local‑file‑read zero‑day that leaks data via grep’s output.