Skip to main content

Node Version Manager CVE-2026-118905

| EUVDEUVD-2026-112603 HIGH
OS Command Injection (CWE-78)
2026-10-29 harborist
7.1
CVSS 4.0 · Vendor: harborist
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Plant malicious .nvmrc in a repository
  2. Delivery
    Victim clones and cd's into directory
  3. Exploit
    Auto-switch hook passes string to nvm_ls
  4. Execution
    Crafted '#' closes sed address and injects 'e'
  5. Impact
    Arbitrary 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 nvm_ls via nvm use, nvm which, nvm ls, nvm version, nvm run, nvm exec, or nvm-exec through NODE_VERSION. For the drive-by .nvmrc path the victim must have the non-default bash cdnvm or zsh load-nvmrc auto-switch hook (documented in the README but not installed by default) and change into a directory under a malicious .nvmrc, or run a script that does nvm use "$(cat .nvmrc)". Key limiting factors: a bare nvm use is NOT affected because nvm's own .nvmrc parser strips comments; exploitation needs local access plus victim interaction; and full arbitrary command execution applies only under GNU sed (the e command), whereas BSD sed limits impact to file write/read via w/r.

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 .nvmrc, but code runs only when a victim with the bash cdnvm or zsh load-nvmrc auto-switch hook installed cd's into the directory (or runs a script like nvm use "$(cat .nvmrc)"), and at least one node version is installed. No KEV listing is present and no EPSS score was supplied, so there is no signal of active or widespread exploitation; the vuln.today decision label is 'this_week', consistent with a serious issue that is not an emergency. Exploitation status is 'no public exploit identified at time of analysis' - the GHSA advisory ships a regression test that demonstrates the sed error, but no weaponized exploit is flagged in the input. The most important nuance: real impact depends on the sed implementation - with GNU sed the e command yields arbitrary shell command execution as the user (full compromise), while with BSD sed only the w/r file write/read commands are reachable, limiting impact to file read/write. The headline risk is to developer workstations using auto-switch hooks, not to default nvm installs (bare nvm use is unaffected because nvm's own .nvmrc parser strips comments).

Exploit ScenarioDerived

An attacker publishes a repository containing a malicious .nvmrc whose version string embeds a # to close the sed address early followed by a sed e command. A developer who has the documented bash cdnvm or zsh load-nvmrc auto-switch hook installed clones the repo and changes into the directory; the hook reads .nvmrc verbatim and passes it to nvm ls/nvm version, and with GNU sed the injected e command executes the attacker's shell payload as that user. No public weaponized exploit is flagged, though the vendor advisory includes a test case that reproduces the parsing flaw.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

nvm 0.31.2 <0.40.6

Affected Packages

euvd nvm fix: 0.40.6

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

Vendor (harborist) PRIMARY 7.1 HIGH
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
vuln.today AI 7.0 HIGH

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.

3.1 AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (harborist).

CVSS VectorVendor: harborist

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Active
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

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.

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

Why It Matters

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.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.1%
Top 97% exploitable
Prevalence
High
extremely popular node.js version manager on developer machines
Social Media
1
Sightings
Data Quality
5 sources
Confidence: Medium

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact
High

Priority Score

36
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +36
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

OS command injection occurs when an application passes unsanitized user input directly into system shell commands.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy