7.1
HIGH CVSS 4.0
CVE-2026-118905
nvm_ls lets an untrusted version string inject sed commands, executing arbitrary commands with GNU sed
Description

Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.31.2 through 0.40.5, `nvm_ls` filters installed versions with a sed program that embeds the requested version pattern in a `\#...#` address, escaping `.` (and, since 0.40.4, `#`) but not backslash. A version string containing `#` (or `\#`) therefore closes the address early, and the rest of it is parsed as sed commands: with GNU sed, the `e` command runs a shell command as the user; with BSD sed, the `w` and `r` commands write and read files. This is reachable whenever an attacker-influenced version string is passed to `nvm use`, `nvm which`, `nvm ls`, `nvm version`, `nvm run`, or `nvm exec`, or to `nvm-exec` via `NODE_VERSION`, and at least one version is installed. nvm's own `.nvmrc` parser strips comments, so a bare `nvm use` is not affected; however, the bash `cdnvm` and zsh `load-nvmrc` auto-switch hooks documented in the README read `.nvmrc` as-is and pass it to `nvm ls` and `nvm version`, so a user with one of those hooks installed runs the attacker's command just by changing into a directory under a malicious `.nvmrc`; scripts that run `nvm use "$(cat .nvmrc)"` are affected the same way. Version 0.40.6 passes any version pattern containing `#` or a newline through the `.nvmrc` content parser first, so no `#` reaches the sed program.

INFO

Published Date :

Oct. 29, 2026, 6:17 a.m.

Last Modified :

Oct. 29, 2026, 6:17 a.m.

Remotely Exploit :

No

Source :

7ffcee3d-2c14-4c3e-b844-86c6a321a158
Affected Products

The following products are affected by CVE-2026-118905 vulnerability. Even if cvefeed.io is aware of the exact versions of the products that are affected, the information is not represented in the table below.

ID Vendor Product Action
1 Openjsf node_version_manager
CVSS Scores
The Common Vulnerability Scoring System is a standardized framework for assessing the severity of vulnerabilities in software and systems. We collect and displays CVSS scores from various sources for each CVE.
Score Version Severity Vector Exploitability Score Impact Score Source
CVSS 3.1 HIGH 7ffcee3d-2c14-4c3e-b844-86c6a321a158
CVSS 3.1 HIGH MITRE-CVE
CVSS 4.0 HIGH 7ffcee3d-2c14-4c3e-b844-86c6a321a158
CVSS 4.0 HIGH 7ffcee3d-2c14-4c3e-b844-86c6a321a158
Solution
Update NVM to version 0.40.6 or later to fix the sed command injection vulnerability.
  • Update Node Version Manager to version 0.40.6.
  • Avoid running untrusted version strings.
  • Review and update nvm's .nvmrc parser.
  • Remove malicious .nvmrc files.
References to Advisories, Solutions, and Tools

Here, you will find a curated list of external links that provide in-depth information, practical solutions, and valuable tools related to CVE-2026-118905.

URL Resource
https://github.com/nvm-sh/nvm/commit/82315e2b189528a006da6701eac30e8c364ffd22
https://github.com/nvm-sh/nvm/pull/3854
https://github.com/nvm-sh/nvm/releases/tag/v0.40.6
https://github.com/nvm-sh/nvm/security/advisories/GHSA-vgqf-vc3m-4wv3
CWE - Common Weakness Enumeration

While CVE identifies specific instances of vulnerabilities, CWE categorizes the common flaws or weaknesses that can lead to vulnerabilities. CVE-2026-118905 is associated with the following CWEs:

We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).

Results are limited to the first 15 repositories due to potential performance issues.

The following list is the news that have been mention CVE-2026-118905 vulnerability anywhere in the article.

The following table lists the changes that have been made to the CVE-2026-118905 vulnerability over time.

Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.

  • New CVE Received by 7ffcee3d-2c14-4c3e-b844-86c6a321a158

    Oct. 29, 2026

    Action Type Old Value New Value
    Added Description Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.31.2 through 0.40.5, `nvm_ls` filters installed versions with a sed program that embeds the requested version pattern in a `\#...#` address, escaping `.` (and, since 0.40.4, `#`) but not backslash. A version string containing `#` (or `\#`) therefore closes the address early, and the rest of it is parsed as sed commands: with GNU sed, the `e` command runs a shell command as the user; with BSD sed, the `w` and `r` commands write and read files. This is reachable whenever an attacker-influenced version string is passed to `nvm use`, `nvm which`, `nvm ls`, `nvm version`, `nvm run`, or `nvm exec`, or to `nvm-exec` via `NODE_VERSION`, and at least one version is installed. nvm's own `.nvmrc` parser strips comments, so a bare `nvm use` is not affected; however, the bash `cdnvm` and zsh `load-nvmrc` auto-switch hooks documented in the README read `.nvmrc` as-is and pass it to `nvm ls` and `nvm version`, so a user with one of those hooks installed runs the attacker's command just by changing into a directory under a malicious `.nvmrc`; scripts that run `nvm use "$(cat .nvmrc)"` are affected the same way. Version 0.40.6 passes any version pattern containing `#` or a newline through the `.nvmrc` content parser first, so no `#` reaches the sed program.
    Added CVSS V4.0 AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
    Added CVSS V3.1 AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
    Added CWE CWE-94
    Added CWE CWE-78
    Added Affected New affected value received. <a href="https://github.com/CVEProject/cvelistV5/blob/main/cves/2026/118xxx/CVE-2026-118905.json">CVE-2026-118905</a>
    Added Reference https://github.com/nvm-sh/nvm/commit/82315e2b189528a006da6701eac30e8c364ffd22
    Added Reference https://github.com/nvm-sh/nvm/pull/3854
    Added Reference https://github.com/nvm-sh/nvm/releases/tag/v0.40.6
    Added Reference https://github.com/nvm-sh/nvm/security/advisories/GHSA-vgqf-vc3m-4wv3
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days. Following chart shows the EPSS score history of the vulnerability.