Shell command injection in Node Version Manager by nvm
CVE-2026-118905

7.1HIGH

Key Information:

Vendor

Nvm-sh

Status
Vendor
CVE Published:
29 October 2026

What is CVE-2026-118905?

A vulnerability in Node Version Manager (nvm) allows attackers to execute shell commands through a crafted version string, particularly when the nvm_ls function processes input. The flaw arises as version patterns containing special characters can inadvertently terminate the sed command address, with subsequent input being treated as sed commands instead. This exploitation method can occur whenever a maliciously influenced version string is used in nvm commands. Users of specific auto-switch hooks that read .nvmrc files are at risk, allowing attackers to run arbitrary commands merely by navigating into directories containing compromised .nvmrc files. Version 0.40.6 mitigates this by improving input handling, ensuring that potentially dangerous characters are not processed by the securing commands.

Affected Version(s)

nvm 0.31.2 < 0.40.6

References

CVSS V4

Score:
7.1
Severity:
HIGH
Confidentiality:
High
Integrity:
High
Availability:
High
Attack Vector:
Local
Attack Complexity:
Low
Attack Required:
Physical
Privileges Required:
Undefined
User Interaction:
Unknown

Timeline

  • Vulnerability published

  • Vulnerability Reserved

Credit

vnth4nhnt of CyStack (https://github.com/vnth4nhnt)
sjh9714 (https://github.com/sjh9714)
.