2.1low
nvm path traversal via a malicious mirror's LTS codename writes outside the alias directory
- Severity
- 2.1low CVSS:4.0 by harborist
- Exploit likelihood
- 0.26% (higher than 19% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- harborist
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| nvm-sh nvm | from 0.32.1 before 0.40.6 | CVE List |
All scores
| harborist | 2.1low CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N |
| harborist | 3.1low CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:N |
Classification
What each source says
CVE List
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.
NVD (es)
Node Version Manager (nvm) es una función de shell compatible con POSIX para gestionar múltiples versiones de node.js. En las versiones 0.32.1 a 0.40.5, ’nvm ls-remote’ (y otros comandos que actualizan alias LTS remotos, como ’nvm install --lts’) analizan el ’index.tab’ del mirror de node.js y usan el campo de nombre en clave LTS de cada lanzamiento como un nombre de archivo de alias sin validarlo. Un mirror malicioso, comprometido o con un ataque de man-in-the-middle puede devolver un nombre en clave LTS que contenga secuencias de path-traversal como ’.. / .. / .. / .bashrc’, haciendo que nvm escriba la cadena de versión asociada a una ruta fuera de ’$NVM_DIR/alias’. Con la configuración predeterminada (’$NVM_DIR’ es ’~/.nvm’), esto puede crear o sobrescribir archivos en el directorio de inicio del usuario, incluidos los archivos de inicio de shell, lo que puede llevar a la ejecución de código en una sesión de shell posterior. La explotación requiere que la víctima use un mirror hostil -- a través de un mirror o CDN comprometido, un man-in-the-middle de red, o un ’NVM_NODEJS_ORG_MIRROR’/’NVM_IOJS_ORG_MIRROR’ configurado maliciosamente -- y que ejecute un comando afectado. La versión 0.40.6 valida los nombres en clave LTS remotos como nombres de archivo de alias seguros y rechaza los componentes de ruta ’..’ al escribir archivos de alias.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-15921 changed 2026-07-16 | CVE Terms of Use |
| NVD | CVE-2026-15921 changed 2026-10-24 | Public domain |