/

CVE-2026-10796

Severity:

HIGH RISK

(7.5)

OS Command Injection (CWE-78) via Mirror-Controlled Version Strings in nvm (Node Version Manager)

CVE-2026-10796

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

nvm (Node Version Manager) through 0.40.4 is vulnerable to OS command injection when it consumes untrusted version strings from a configured Node.js/io.js mirror.

If an attacker can control or tamper with the mirror contents, they can craft version entries that cause arbitrary commands to be executed with the privileges of the user running nvm.

Affected context

This vulnerability appears in environments where nvm is configured to use a Node.js/io.js mirror whose index.tab file is not fully trusted.

It is relevant whenever commands like nvm install or related operations parse version listings from a mirror and construct shell or awk commands from those values.

Typical exposure scenarios include custom or third-party mirrors, non-TLS mirrors vulnerable to man-in-the-middle attacks, or any situation where mirror content may be influenced by an attacker.

Exploit preconditions

  • Attack surface: nvm clients that fetch version listings (index.tab) from a configured mirror.
  • Required access: Ability to control or modify the mirror response (e.g., operating a malicious mirror, supplying content to a CI environment using a non-default mirror, or intercepting traffic to a non-TLS mirror).
  • Trigger point: Running nvm commands that read and act on version entries, such as nvm install, which triggers nvm_download() and nvm_get_checksum().
  • Why exploitation is possible: Version fields from index.tab are treated as trusted and interpolated directly into shell commands executed via eval and into awk programs, allowing shell/awk features like command substitution and system() to run attacker-controlled commands.

Why this happens

The core bug is the unsafe incorporation of untrusted data into shell and awk command strings.

nvm reads version identifiers from a mirror's index.tab and uses them directly to build command lines in two places:

  • nvm_download() constructs a curl/wget shell command and executes it via eval, causing any shell metacharacters or command substitutions in the version string to be interpreted by the shell.
  • nvm_get_checksum() interpolates the derived download slug into an awk program, enabling crafted inputs to invoke arbitrary commands via awk's system() function.

This pattern maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, where inputs that should be treated as data are instead parsed as part of executable command syntax.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the user running nvm.
  • Compromise of developer workstations or CI agents that rely on nvm for Node.js installation.
  • Unauthorized modification of source code, build artifacts, or configuration files accessible to the compromised account.
  • Theft of credentials, tokens, or other sensitive information present in the environment.
  • Establishment of persistent backdoors or lateral movement starting from compromised developer or CI environments.

General mitigation guidance

Effective mitigation focuses on eliminating command injection vectors and constraining the trust boundary around mirror-supplied data:

  • Avoid building shell command lines via string concatenation and eval; instead, pass parameters as literal argv elements to system utilities.
  • Treat mirror-provided version values as untrusted input and validate them strictly against the expected Node.js/io.js version grammar before use.
  • When invoking interpreters like awk, pass untrusted values as data (e.g., via -v or stdin) rather than interpolating them into the program source.
  • Prefer the default, TLS-protected official Node.js mirror and avoid non-TLS or unverified third-party mirrors whenever possible.
  • Run nvm and related tooling under accounts with least-privilege access, limiting the potential damage of a successful command injection.

How teams detect issues like this

Detection typically involves a mix of code-level and operational checks:

  • Static analysis and code review: Look for shell invocations that use eval, string-interpolated commands, or unquoted variable expansion, especially where values originate from remote resources (like mirrors or index files).
  • Input handling review: Verify that all version strings are validated against a strict grammar before being used in command construction, and that no untrusted input is embedded directly into interpreter programs (e.g., awk, sed).
  • Policy and tooling: Enforce repository policies that discourage use of eval and demand argument-based invocation of system tools; automated linters or shell analyzers can flag dangerous patterns in shell scripts.
  • Runtime monitoring: On high-value developer and CI systems, monitor for anomalous process trees originating from nvm commands or awk processes executing unexpected subcommands.

Sources

SourceLink
github.comgithub.com/nvm-sh/nvm/commit/6d870d182cd5333647ffa16c0d7dbcd817ec27a8
github.comgithub.com/nvm-sh/nvm/commit/70fb4ede6b9731d75d86451d48caa5faffbec21c
github.comgithub.com/nvm-sh/nvm/commit/90bb88748ba6c29c2cec73b18ed7057413aef308
github.comgithub.com/nvm-sh/nvm/security/advisories/GHSA-3c52-35h2-gfmm

Frequently asked

questions

It can be, but only indirectly. An attacker must control or tamper with the Node.js/io.js mirror that nvm is configured to use, or be able to intercept traffic to an insecure mirror. Once they can influence index.tab, any user or CI system fetching versions from that mirror can become a target.

The attacker's commands run with the privileges of the user executing nvm. On a developer machine, this is typically the developer's account; in CI, it is the CI runner's user. If that account has broad permissions or access to sensitive data, the impact can be significant.

The general fix is to avoid constructing command strings that mix code and data. Pass all untrusted inputs as literal arguments or data streams to tools, validate them against strict syntactic rules (such as a version grammar), and remove any eval-based execution paths.

Design shell scripts with explicit trust boundaries, treat all external inputs (files, mirrors, environment variables) as untrusted by default, and apply rigorous validation before use. Prohibit eval where possible, enforce quoting of variables, pass untrusted values via argv or flags (like awk's -v), and include automated checks in CI to flag risky shell patterns.

Find out what's already
exploitable in your codebase.