Description
nvm resolves a requested version or alias by treating it as a filename under $NVM_DIR/alias. Before 0.40.8, nvm_alias() concatenated the requested name onto that directory and read the result with no containment check, so a name containing a `..` component escaped the alias directory; under the default layout an alias such as `../../.npmrc` resolves to a file in the user's home directory. nvm_print_alias_file() then emits every non-comment, non-empty line of whatever was opened. A version string taken from an untrusted .nvmrc reaches this path, so a developer who runs `nvm use`, `nvm install`, or `nvm which` inside an attacker-supplied repository discloses the first non-comment line of an arbitrary file readable by that user, in the resulting "is not yet installed" error message. A user-supplied `nvm alias <traversing-name>` discloses every non-comment line of the target file. There is no integrity or availability impact, and no command execution on this path.
Published: 2026-09-21
Score: 6.7 Medium
EPSS: n/a
KEV: No
Impact: Information Disclosure
Action: Patch
AI Analysis

Impact

The vulnerability arises because the nvm tool, before version 0.40.8, concatenates a requested alias name directly onto the $NVM_DIR/alias directory without checking for path‑traversal components. An alias containing a .. segment allows exit from the intended directory, causing nvm to read arbitrary files that the user can access. When a library or .nvmrc file supplies such an alias, the first non‑comment line of the file is included in an error message, while directly calling nvm alias reveals every non‑comment line of the target file. This flaw does not alter the system state or execute code, but it leaks sensitive information such as configuration files or environment data, constituting an Information Exposure (CWE‑200) and Path Traversal (CWE‑22) weakness.

Affected Systems

The affected product is the nvm‑sh/nvm JavaScript version manager. Any installation older than version 0.40.8 is vulnerable. Developers who run nvm commands—nvm use, nvm install, nvm which, or nvm alias—within a repository or configuration that contains a malicious alias or .nvmrc file are at risk.

Risk and Exploitability

The CVSS score of 6.7 places this flaw in the medium severity range. No EPSS score is available, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. The attack route requires local execution of an nvm command with an attacker‑controlled alias name or .nvmrc file; a local attacker or a malicious repository can trigger the disclosure. Because no elevated privilege or execution is required, exploitation risk is limited to the user’s own environment, but the information leaked can be valuable in social‑engineering or credential‑stealing scenarios.

Generated by OpenCVE AI on September 21, 2026 at 03:58 UTC.

Remediation

Vendor Solution

Upgrade to nvm 0.40.8 or later, which rejects any `..` path component in nvm_alias() and nvm_version_path().


OpenCVE Recommended Actions

  • Upgrade nvm to version 0.40.8 or later to prevent the traversal check from failing
  • Inspect and sanitize any .nvmrc or alias files in the repository for '..' or other path‑traversal components before executing nvm commands
  • As a temporary measure, run nvm commands only on trusted repositories and avoid executing them in environments where malicious code may be present

Generated by OpenCVE AI on September 21, 2026 at 03:58 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Mon, 21 Sep 2026 04:45:00 +0000

Type Values Removed Values Added
First Time appeared Nvm-sh
Nvm-sh nvm
Vendors & Products Nvm-sh
Nvm-sh nvm

Mon, 21 Sep 2026 02:45:00 +0000

Type Values Removed Values Added
Description nvm resolves a requested version or alias by treating it as a filename under $NVM_DIR/alias. Before 0.40.8, nvm_alias() concatenated the requested name onto that directory and read the result with no containment check, so a name containing a `..` component escaped the alias directory; under the default layout an alias such as `../../.npmrc` resolves to a file in the user's home directory. nvm_print_alias_file() then emits every non-comment, non-empty line of whatever was opened. A version string taken from an untrusted .nvmrc reaches this path, so a developer who runs `nvm use`, `nvm install`, or `nvm which` inside an attacker-supplied repository discloses the first non-comment line of an arbitrary file readable by that user, in the resulting "is not yet installed" error message. A user-supplied `nvm alias <traversing-name>` discloses every non-comment line of the target file. There is no integrity or availability impact, and no command execution on this path.
Title nvm alias resolution follows `..` and discloses files outside $NVM_DIR/alias
Weaknesses CWE-200
CWE-22
References
Metrics cvssV3_1

{'score': 5.5, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N'}

cvssV4_0

{'score': 6.7, 'vector': 'CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: harborist

Published:

Updated: 2026-09-21T02:27:00.752Z

Reserved: 2026-09-21T02:14:56.481Z

Link: CVE-2026-94185

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-09-21T03:16:34.243

Modified: 2026-09-21T03:16:34.243

Link: CVE-2026-94185

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-09-21T04:30:08Z

Weaknesses
  • CWE-200

    Exposure of Sensitive Information to an Unauthorized Actor

  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')