CVE-2026-121746

nvm use --save and nvm install --save write through a symlinked .nvmrc, overwriting any file the user can write

Published Nov 4, 2026 CVSS 4.0 · 6.7 Medium EPSS < 1% KEV · Not listed
Description
Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.40.0 through 0.40.8, `nvm use --save` and `nvm install --save` (or `-w`) write the resolved version to `$PWD/.nvmrc` with `tee`, which follows a symbolic link. A repository that commits `.nvmrc` as a symlink to a path outside itself (git recreates the link on clone) therefore makes `--save` truncate any file the user can write, such as a shell startup file or `~/.ssh/authorized_keys`, and replace its contents with the version string, or create the target of a dangling link; the link itself is left unchanged, so `git status` stays clean. The attacker does not control the content written, so this is data loss, not code execution. Version 0.41.0 refuses, with a warning, to write when `.nvmrc` in the current directory is a symlink, dangling or not, rather than writing through it or replacing it.

Analysis

AI-generated

Technical impact

The vulnerability occurs in nvm versions 0.40.0 through 0.40.8 when the --save option writes the resolved Node.js version using tee, following a symbolic link. If .nvmrc is a symlink pointing outside the repository, the write operation overwrites the target file, which the user can modify, potentially deleting or corrupting startup scripts or authorized_keys. The attacker cannot influence the content written; the result is data loss or accidental overwrite, not code execution.

Affected Systems

Node Version Manager (nvm) 0.40.0 through 0.40.8 is affected. Versions 0.41.0 and later address the issue by refusing to write when .nvmrc is a symlink. The product is maintained by nvm‑sh. Users on any platform running these affected nvm releases are vulnerable.

Risk and Exploitability

The CVSS score of 6.7 indicates a moderate impact. EPSS score is not available, so the likelihood of exploitation remains uncertain, but the issue is not listed in the CISA KEV catalog. Exploitation requires the attacker to place a symlinked .nvmrc in a repository that the user will clone or otherwise place in a writable directory, and that the user runs nvm use --save or nvm install --save. A typical social engineering or supply‑chain attack could achieve this. Because the vulnerability only overwrites data, the risk is primarily accidental corruption rather than a remote exploitation vector.

Remediation

Vendor Solution

Upgrade to nvm 0.41.0 or later.


Vendor Workaround

Until upgrading, check that `.nvmrc` is not a symlink (`ls -l .nvmrc`) before running `nvm use --save` or `nvm install --save` in an untrusted project directory.


OpenCVE Recommended Actions

  • Upgrade to nvm 0.41.0 or later. From 0.41.0 onward the tool refuses to write when .nvmrc is a symlink, preventing this behaviour.
  • If a patch cannot be applied immediately, run `ls -l .nvmrc` before executing `nvm use --save` or `nvm install --save` in any untrusted project directory and abort if the file is a symlink.
  • Avoid using the --save option in repositories that contain a symlinked .nvmrc, or enforce project policies that disallow such links; if possible, remove or make the symlink read‑only in workspaces that may be exposed to untrusted code.

Generated by OpenCVE AI on November 4, 2026 at 22:52 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Nvm-sh
Nvm-sh nvm
Vendors & Products Nvm-sh
Nvm-sh nvm
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.40.0 through 0.40.8, `nvm use --save` and `nvm install --save` (or `-w`) write the resolved version to `$PWD/.nvmrc` with `tee`, which follows a symbolic link. A repository that commits `.nvmrc` as a symlink to a path outside itself (git recreates the link on clone) therefore makes `--save` truncate any file the user can write, such as a shell startup file or `~/.ssh/authorized_keys`, and replace its contents with the version string, or create the target of a dangling link; the link itself is left unchanged, so `git status` stays clean. The attacker does not control the content written, so this is data loss, not code execution. Version 0.41.0 refuses, with a warning, to write when `.nvmrc` in the current directory is a symlink, dangling or not, rather than writing through it or replacing it.
Title nvm use --save and nvm install --save write through a symlinked .nvmrc, overwriting any file the user can write
Weaknesses CWE-59
References
Metrics cvssV3_1

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

cvssV4_0

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

Weaknesses
  • CWE-59

    Improper Link Resolution Before File Access ('Link Following')

Sources

Status
PUBLISHED
Assigner
harborist
Published
Updated
Nov 9, 2026, 8:42 PM
Reserved
Nov 3, 2026, 11:38 PM
Status
Awaiting Analysis
Published
Nov 4, 2026, 10:17 PM
Modified
Nov 10, 2026, 9:46 PM
Severity
Moderate
Public date
Nov 4, 2026, 9:31 PM