Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessPlant malicious .nvmrc in a repository
-
DeliveryVictim clones and cd's into directory
-
ExploitAuto-switch hook passes string to nvm_ls
-
ExecutionCrafted '#' closes sed address and injects 'e'
-
ImpactArbitrary shell command runs as the user
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK
2 techniques across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires nvm 0.31.2 through 0.40.5 with at least one node version already installed, and an attacker-influenced version string containing '#' (or '\#') reaching |
| Impact | This is a genuine but conditional OS command injection (CWE-78/CWE-94) rather than a drop-everything remote flaw. The CVSS 4.0 vector (7.1, AV:L/AC:L/AT:P/PR:N/UI:A) correctly signals a local vector that requires both user interaction and a specific attack precondition, which matches the described mechanism: the attacker only plants a malicious |
| Exploit ScenarioDerived | An attacker publishes a repository containing a malicious |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 29, 2026
OS command injection in Node Version Manager (nvm) 0.31.2 through 0.40.5 lets an attacker-influenced version string break out of the sed address used by nvm_ls and be parsed as sed commands, running arbitrary shell commands as the invoking user under GNU sed (the 'e' command) or reading/writing files under BSD sed (the 'w' and 'r' commands). Reachability is conditional and local: the crafted string must be passed to nvm use, nvm which, nvm ls, nvm version, nvm run, nvm exec, or nvm-exec via NODE_VERSION, at least one Node version must already be installed, and the README-documented bash cdnvm or zsh load-nvmrc auto-switch hooks turn a malicious .nvmrc into drive-by execution when the user changes into that directory (a bare nvm use is unaffected because nvm's own .nvmrc parser strips comments, as are scripts that run nvm use "$(cat .nvmrc)" - those remain exposed). No public exploit identified at time of analysis; the vendor fix landed in 0.40.6 and this is queued for remediation this week rather than treated as an emergency.
RemediationAI
Vendor-released patch: upgrade to nvm 0.40.6 or later (release https://github.com/nvm-sh/nvm/releases/tag/v0.40.6, fix commit 82315e2b189528a006da6701eac30e8c364ffd22 via PR https://github.com/nvm-sh/nvm/pull/3854); the advisory states no action is needed beyond upgrading, and remediation is scheduled for this week. Because the fix routes patterns containing '#' or a newline through nvm's .nvmrc content parser, 0.40.6 prevents any '#' from reaching the sed program. Where upgrading must wait, the exposure paths can be narrowed: remove or disable the optional cdnvm (bash) and load-nvmrc (zsh) auto-switch hooks, which the advisory identifies as the drive-by vector since they read .nvmrc as-is and pass it to nvm ls and nvm version - the trade-off is losing automatic Node version switching on directory change - and avoid script patterns such as nvm use "$(cat .nvmrc)" that feed file contents straight into nvm_ls, replacing them with a bare nvm use, which is not affected because nvm's own .nvmrc parser strips comments. Do not pass untrusted or externally supplied version strings to nvm use, nvm which, nvm ls, nvm version, nvm run, nvm exec, or nvm-exec's NODE_VERSION. Note that on BSD sed the impact is limited to file write/read via 'w' and 'r', while GNU sed additionally allows shell command execution via 'e'; full advisory detail is at https://github.com/nvm-sh/nvm/security/advisories/GHSA-vgqf-vc3m-4wv3.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
nvm is a POSIX shell function library, and nvm_ls filters the list of installed versions with a sed program that interpolates the requested version pattern directly into a \#...
address delimiter. Before the fix the pattern was escaped for '.' (and, since v0.40.4, for '#') but not for backslash, so a pattern containing '#' or '\#' closes the address early and the remainder is parsed as sed commands - a classic CWE-78 OS command injection rooted in unescaped metacharacter interpolation into a shell-invoked program (the advisory also classifies it as CWE-94). Impact depends on the sed implementation: GNU sed's 'e' command executes a shell command as the current user, giving full code execution, whereas BSD sed lacks 'e' so an attacker is limited to 'w' and 'r' file write/read primitives. The flaw has existed since nvm_ls began filtering with this sed address in commit b0244a13 (v0.31.2). The fix in commit 82315e2b refactors the .nvmrc handling into nvm_process_nvmrc_content and routes any pattern containing '#' or a newline through that content parser first, which strips comments so no '#' reaches the sed program. The supplied CVSS 4.0 vector (AV:L/AC:L/AT:P/PR:N/UI:A) describes a local, interaction-dependent attack with attack requirements present; it is severity metadata and does not itself document the trigger mechanics beyond what the advisory states.
Know when Nvm gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
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
Local vector via a planted .nvmrc; AC:H because it requires a non-default auto-switch hook/script and an installed version; UI:R for the victim's cd/action; PR:N as the attacker needs no account; full code execution as the user gives C/I/A High.
Primary rating from Vendor (harborist).
CVSS VectorVendor: harborist
DescriptionCVE.org
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.
Articles & Coverage 1
Technical POC Analysis
CWE-78 (OS command injection), with CWE-94 also assigned.
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
Node Version Manager (nvm) versions 0.31.2 through 0.40.5 contain an OS command injection flaw that allows an attacker to execute arbitrary commands as the invoking user. The vulnerability is exploitable when a malicious .nvmrc file is present and the user has the recommended auto-switch hooks enabled, turning directory changes into drive-by execution. Development teams using nvm to manage Node.js environments are at risk, and leadership should prioritize patching to prevent unauthorized command execution on developer workstations.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
OS command injection occurs when an application passes unsanitized user input directly into system shell commands.
Command injection in nvm (Node Version Manager) versions through 0.40.4 allows attackers controlling the configured Node
Information disclosure in nvm versions before 0.40.8 allows a local attacker who controls a repository to read arbitrary
Path traversal in nvm versions 0.32.1 through 0.40.5 allows a hostile Node.js mirror to overwrite arbitrary files in the
EUVD-2026-112603
NVD
CVE.org
EPSS
GitHub
Exploit-DB