Description
Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.27.0 through 0.40.8, when a project's `.npmrc` sets `prefix`, `nvm use` tells the user to run `nvm use --delete-prefix`, which runs `npm config delete prefix` and `npm config delete globalconfig` in the current directory without naming a config file. npm loads the project `.npmrc` before deciding which file to edit, so that file chooses the target: `userconfig=~/.bashrc` makes npm rewrite `~/.bashrc` as ini (corrupting it), and `location=global` with `globalconfig=` leaves the chosen file at mode 0666, which on a shared machine lets another local user write to it. The attacker (the author of a cloned repository or archive, or a local user who can write a shared parent directory) chooses the file but not the bytes written, and no project code runs. Version 0.41.0 no longer lets a project `.npmrc` select which config file `--delete-prefix` edits.
Published: 2026-11-04
Score: 1.8 Low
EPSS: n/a
KEV: No
Impact: Configuration Modification
Action: Apply Patch
AI Analysis

Impact

In Node Version Manager (nvm) versions 0.27.0 through 0.40.8, a project’s .npmrc can specify a prefix setting. When a user runs nvm use with the --delete-prefix flag, nvm executes npm config delete prefix and npm config delete globalconfig without naming a configuration file. npm loads the project .npmrc first, so the settings in that file determine which configuration file is edited. The attacker can cause npm to overwrite a user’s own configuration file (for example, corrupting ~/.bashrc when the prefix setting points to it) or to set the target file to mode 0666, making it world‑writable on shared systems. No project code runs during this process; the damage manifests as unintended configuration changes that can lead to local privilege escalation through file corruption or arbitrary local file write.

Affected Systems

The vulnerability affects the Node Version Manager implementation maintained by nvm-sh under the vendor product nvm. All releases from 0.27.0 up to and including 0.40.8 are impacted. Versions 0.41.0 and later have removed the ability for a project .npmrc to dictate which configuration file --delete-prefix edits, eliminating the flaw.

Risk and Exploitability

The base CVSS score of 1.8 indicates low severity, and no EPSS data is provided. The vulnerability is not listed in CISA KEV. Based on the description, the attacker can be a local user with write access to a shared parent directory or the author of a malicious repository. This conclusion is inferred because the description describes local file write capabilities but does not explicitly state the attack vector. Exploitation requires only local file write access and does not involve code execution. The risk is limited to accidental or intentional configuration corruption or the creation of world‑writable configuration files on shared systems.

Generated by OpenCVE AI on November 4, 2026 at 23:39 UTC.

Remediation

Vendor Solution

Upgrade to nvm 0.41.0 or later.


Vendor Workaround

Until upgrading, do not run `nvm use --delete-prefix` in an untrusted project directory; remove the `prefix` setting from your own npmrc files by hand instead.


OpenCVE Recommended Actions

  • Upgrade to nvm 0.41.0 or newer to eliminate the flaw.
  • When working with untrusted or remotely cloned directories, avoid executing nvm use --delete-prefix; instead, edit or remove the prefix setting manually from your own npmrc files.
  • Verify that npm configuration files such as ~/.bashrc and other files written by npm have correct ownership and permissions so they are not world‑writable.

Generated by OpenCVE AI on November 4, 2026 at 23:39 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 04 Nov 2026 23:00:00 +0000

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

Wed, 04 Nov 2026 21:30:00 +0000

Type Values Removed Values Added
Description Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.27.0 through 0.40.8, when a project's `.npmrc` sets `prefix`, `nvm use` tells the user to run `nvm use --delete-prefix`, which runs `npm config delete prefix` and `npm config delete globalconfig` in the current directory without naming a config file. npm loads the project `.npmrc` before deciding which file to edit, so that file chooses the target: `userconfig=~/.bashrc` makes npm rewrite `~/.bashrc` as ini (corrupting it), and `location=global` with `globalconfig=` leaves the chosen file at mode 0666, which on a shared machine lets another local user write to it. The attacker (the author of a cloned repository or archive, or a local user who can write a shared parent directory) chooses the file but not the bytes written, and no project code runs. Version 0.41.0 no longer lets a project `.npmrc` select which config file `--delete-prefix` edits.
Title nvm use --delete-prefix lets a project .npmrc choose which file npm rewrites or makes world-writable
Weaknesses CWE-73
References
Metrics cvssV3_1

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

cvssV4_0

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


cve-icon MITRE

Status: PUBLISHED

Assigner: harborist

Published:

Updated: 2026-11-04T21:29:25.656Z

Reserved: 2026-11-03T23:38:59.224Z

Link: CVE-2026-121748

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-11-04T22:17:54.523

Modified: 2026-11-04T22:17:54.523

Link: CVE-2026-121748

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-11-04T22:45:14Z

Weaknesses
  • CWE-73

    External Control of File Name or Path