CVE-2026-15921: CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in nvm-sh nvm
Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.32.1 through 0.40.5, `nvm ls-remote` (and other commands that refresh remote LTS aliases, such as `nvm install --lts`) parse the node.js mirror's `index.tab` and use each release's LTS codename field as an alias filename without validating it. A malicious, compromised, or man-in-the-middled mirror can return an LTS codename containing path-traversal sequences such as `../../../.bashrc`, causing nvm to write the associated version string to a path outside `$NVM_DIR/alias`. With the default layout (`$NVM_DIR` is `~/.nvm`), this can create or overwrite files in the user's home directory, including shell startup files, which can lead to code execution in a later shell session. Exploitation requires the victim to use a hostile mirror -- via a compromised mirror or CDN, a network man-in-the-middle, or a maliciously configured `NVM_NODEJS_ORG_MIRROR`/`NVM_IOJS_ORG_MIRROR` -- and to run an affected command. Version 0.40.6 validates remote LTS codenames as safe alias filenames and rejects `..` path components when writing alias files.
AI Analysis
Technical Summary
The vulnerability in nvm (Node Version Manager) versions 0.32.1 through 0.40.5 involves improper validation of LTS codename fields obtained from the node.js mirror's index.tab file. Commands like 'nvm ls-remote' and 'nvm install --lts' use these codenames as filenames for alias files without sanitizing path traversal sequences. A malicious or compromised mirror can supply a codename containing path traversal characters (e.g., '../../../.bashrc'), causing nvm to write alias files outside the intended $NVM_DIR/alias directory, potentially overwriting critical user files such as shell startup scripts. Exploitation requires the user to run affected commands while configured to use a hostile mirror or under a man-in-the-middle attack. This vulnerability is fixed in nvm version 0.40.6 by validating and rejecting unsafe path components in LTS codenames.
Potential Impact
An attacker controlling or intercepting the node.js mirror responses can cause nvm to write files outside its intended directory, including overwriting user shell startup files. This can lead to arbitrary code execution when the user starts a new shell session. The vulnerability requires user interaction with affected nvm commands and use of a malicious or compromised mirror. The CVSS score is low (2.1) reflecting the need for user action and specific conditions for exploitation.
Mitigation Recommendations
Upgrade nvm to version 0.40.6 or later, which includes validation of remote LTS codenames to prevent path traversal. Until upgrading, avoid using untrusted or compromised mirrors and do not run affected commands with a hostile mirror configured. Patch status is not explicitly stated in the vendor advisory, but version 0.40.6 contains the fix. Check the official nvm repository or vendor advisory for the latest remediation guidance.
CVE-2026-15921: CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in nvm-sh nvm
Description
Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.32.1 through 0.40.5, `nvm ls-remote` (and other commands that refresh remote LTS aliases, such as `nvm install --lts`) parse the node.js mirror's `index.tab` and use each release's LTS codename field as an alias filename without validating it. A malicious, compromised, or man-in-the-middled mirror can return an LTS codename containing path-traversal sequences such as `../../../.bashrc`, causing nvm to write the associated version string to a path outside `$NVM_DIR/alias`. With the default layout (`$NVM_DIR` is `~/.nvm`), this can create or overwrite files in the user's home directory, including shell startup files, which can lead to code execution in a later shell session. Exploitation requires the victim to use a hostile mirror -- via a compromised mirror or CDN, a network man-in-the-middle, or a maliciously configured `NVM_NODEJS_ORG_MIRROR`/`NVM_IOJS_ORG_MIRROR` -- and to run an affected command. Version 0.40.6 validates remote LTS codenames as safe alias filenames and rejects `..` path components when writing alias files.
CVSS v4.0
Score 2.1low
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in nvm (Node Version Manager) versions 0.32.1 through 0.40.5 involves improper validation of LTS codename fields obtained from the node.js mirror's index.tab file. Commands like 'nvm ls-remote' and 'nvm install --lts' use these codenames as filenames for alias files without sanitizing path traversal sequences. A malicious or compromised mirror can supply a codename containing path traversal characters (e.g., '../../../.bashrc'), causing nvm to write alias files outside the intended $NVM_DIR/alias directory, potentially overwriting critical user files such as shell startup scripts. Exploitation requires the user to run affected commands while configured to use a hostile mirror or under a man-in-the-middle attack. This vulnerability is fixed in nvm version 0.40.6 by validating and rejecting unsafe path components in LTS codenames.
Potential Impact
An attacker controlling or intercepting the node.js mirror responses can cause nvm to write files outside its intended directory, including overwriting user shell startup files. This can lead to arbitrary code execution when the user starts a new shell session. The vulnerability requires user interaction with affected nvm commands and use of a malicious or compromised mirror. The CVSS score is low (2.1) reflecting the need for user action and specific conditions for exploitation.
Mitigation Recommendations
Upgrade nvm to version 0.40.6 or later, which includes validation of remote LTS codenames to prevent path traversal. Until upgrading, avoid using untrusted or compromised mirrors and do not run affected commands with a hostile mirror configured. Patch status is not explicitly stated in the vendor advisory, but version 0.40.6 contains the fix. Check the official nvm repository or vendor advisory for the latest remediation guidance.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- harborist
- Date Reserved
- 2026-07-15T20:49:26.387Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a57fcc868715ace4384e498
Added to database: 07/15/2026, 21:34:00 UTC
Last enriched: 07/15/2026, 21:48:15 UTC
Last updated: 07/16/2026, 02:35:31 UTC
Views: 8
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.