Command injection in nvm through malicious mirror LTS alias values
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Active
- Attack complexity
- Low
- Attack requirements
- Present
- Impact type
- Code execution
- Confidentiality · integrity · availability
- None · Low · None
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA. Impact type from CWE-78.
Summary
nvm from 0.39.6 before 0.41.0 is affected. It saves unvalidated version strings from a remote mirror's index.tab as LTS aliases, then evaluates them as shell arithmetic, where bash and zsh run embedded command substitutions (CWE-78). An attacker who controls a mirror the user uses, through a compromised mirror or network interception of an http mirror, can run commands as that user when the user runs a local nvm command such as nvm ls.
Written with Claude Haiku 5.5 from the sources below · 2026-11-06
Description from the CNA
Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.39.6 through 0.40.8, `nvm ls-remote` (and other commands that refresh remote LTS aliases) store the version column of the mirror's `index.tab` in `$NVM_DIR/alias/lts/` without validating it, and `nvm_normalize_lts` later evaluates any suffix of an `lts/-N` value inside shell arithmetic `$((N+1))`. Under bash and zsh, arithmetic evaluation expands command substitutions in array subscripts, so a stored value such as `lts/-10*path[$(cmd)1]` runs `cmd` as the user when the alias is later resolved by purely local commands (`nvm ls`, `nvm alias`, `nvm use --lts`, `nvm which lts/`), and in every new shell when the `default` alias is `lts/*`. Exploitation requires the victim to use a hostile mirror -- via a compromised mirror or CDN, a network man-in-the-middle of an `http://` mirror, or a maliciously configured `NVM_NODEJS_ORG_MIRROR` -- and to run an affected command. The same sink is also reachable from a project `.nvmrc`, which is treated as hardening. dash is not affected. Version 0.41.0 only passes an all-digit `lts/-N` offset to arithmetic and drops `index.tab` rows whose version is not a valid version string.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
Remediation
Update nvm to 0.41.0. That version passes only all-digit LTS offsets to arithmetic and drops index.tab rows whose version is not a valid version string.
Written with Claude Haiku 5.5 from the sources below · 2026-11-06
- Fix · CNA nvm (nvm-sh) Fixed in 0.41.0
Fixed in the same release
Records fixed by the same vendor advisory or release, as the CNA lists them.
- Release ·
nvm-sh nvm 0.41.0
7 records Highest priority Priority LOW 7 LOW
Other records, highest priority first
- TI-2026-85227 nvm prints contents of arbitrary files through a symlinked .nvmrcPriority LOW 29
- TI-2026-85226 nvm --save follows symlinked .nvmrc and overwrites filesPriority LOW 29
- TI-2026-85228 nvm passes .nvmrc contents to grep, leaking local filesPriority LOW 20
Vendor assessments
Timeline
- 2026-11-04 Threatist record created from CVE-2026-121751
- 2026-11-06 Affected versions changed · Red Hat
- 2026-11-06 CVSS score added · Red Hat
References
Patch 1
Advisory 1
More nvm-sh vulnerabilities
- TI-2026-13337 nvm path traversal via a malicious mirror's LTS codename writes outside the alias directory CVSS 4.0LOW 2.1
- TI-2026-82282 Command injection in nvm lets version strings run arbitrary commands CVSS 4.0HIGH 7.1
- TI-2026-85227 nvm prints contents of arbitrary files through a symlinked .nvmrc CVSS 4.0MEDIUM 6.7
- TI-2026-85226 nvm --save follows symlinked .nvmrc and overwrites files CVSS 4.0MEDIUM 6.7
- TI-2026-63368 nvm alias resolution follows `..` and discloses files outside $NVM_DIR/alias CVSS 4.0MEDIUM 6.7
- TI-2026-01349 Command Injection in nvm via NVM_AUTH_HEADER in wget code path CVSS 4.0MEDIUM 5.4
Sources
- CVE-2026-121751 · CVE Program
- CVE-2026-121751 · NVD
- FIRST EPSS
- CVE-2026-121751 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences