Skip to content
RedCVE

CVE-2026-118905Nvm SH Nvm OS command injection

nvm-shPublished:

CVSS score

7.1

High

CVSS 4.0 from 7ffcee3d-2c14-4c3e-b844-86c6a321a158

Exploit probability (EPSS)

0.14%

0.14% chance of exploitation in the next 30 days, higher than 3.24% of all CVEs.

CISA KEV

Not in KEV

No confirmed exploitation reported by CISA so far.

Official 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.

Source: NVD · CNA: 7ffcee3d-2c14-4c3e-b844-86c6a321a158

How to fix it, step by step

  1. Check whether you're affected

    Find every system running nvm-sh Nvm and compare its version with the affected versions.

  2. Update to a fixed version

    • Update Nvm to 0.40.6 or later.
  3. Confirm the fix

    Check that every affected system now reports a fixed version, and recheck the vendor's advisory: fixes are sometimes revised.

Was this useful?

How it can be exploited

Attack vector
Local
Attack complexity
Low
Attack requirements
Present
Privileges required
None
User interaction
Active
Confidentiality
High
Integrity
High
Availability
High

Values in red make the vulnerability easier to exploit or more damaging. CVSS:4.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

Affected products

Affected productsVersions
nvm-sh Nvm≥ 0.31.2, < 0.40.6

Weakness

Timeline

  1. Published:
  2. Last modified:

Frequently asked questions

Is CVE-2026-118905 being exploited?

There is no confirmed exploitation in CISA's KEV catalog so far. Its EPSS score estimates a 0.1% probability of exploitation in the next 30 days.

What is the CVSS score of CVE-2026-118905?

CVE-2026-118905 has a CVSS 4.0 base score of 7.1 (high).

Which versions are affected?

Nvm SH Nvm (≥ 0.31.2, < 0.40.6)

Is there a patch for CVE-2026-118905?

The official record links to vendor advisories or patches; see “What to do” above.

References

Data: NVD, CVE.org (cvelistV5), CISA KEV and FIRST EPSS. Summary written by RedCVE with AI assistance from the official data.