/

CVE-2026-107703

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in node-convert convert.js

CVE-2026-107703

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

CRITICAL RISK

(9.8)

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

A critical OS command injection vulnerability in @enmaso/node-convert allows attacker-controlled filepath and convertTo values to alter an ImageMagick command executed by the Node.js process.

When these arguments are influenced by untrusted input, shell metacharacters or quoting can cause arbitrary operating system commands to run with the process's privileges.

A critical OS command injection vulnerability in @enmaso/node-convert allows attacker-controlled filepath and convertTo values to alter an ImageMagick command executed by the Node.js process.

When these arguments are influenced by untrusted input, shell metacharacters or quoting can cause arbitrary operating system commands to run with the process's privileges.

Affected context

The vulnerability occurs in the convert.js component of @enmaso/node-convert through version 1.0.0, where user-influenced filepath and convertTo arguments are incorporated into a command executed through Node.js child_process.exec().

Risk depends on whether an attacker can control or influence either argument and whether the vulnerable conversion function is reachable through an application, service, or processing workflow.

The vulnerability occurs in the convert.js component of @enmaso/node-convert through version 1.0.0, where user-influenced filepath and convertTo arguments are incorporated into a command executed through Node.js child_process.exec().

Risk depends on whether an attacker can control or influence either argument and whether the vulnerable conversion function is reachable through an application, service, or processing workflow.

Exploit preconditions

  • Attack surface: The image conversion functionality exposed by the Node.js application
  • Required access: The ability to supply or influence filepath or convertTo input
  • Trigger point: Construction and execution of the ImageMagick command through child_process.exec()
  • Why exploitation is possible: Input is incorporated into a shell command without sufficient validation, escaping, or use of an argument-safe process API
  • Attack surface: The image conversion functionality exposed by the Node.js application
  • Required access: The ability to supply or influence filepath or convertTo input
  • Trigger point: Construction and execution of the ImageMagick command through child_process.exec()
  • Why exploitation is possible: Input is incorporated into a shell command without sufficient validation, escaping, or use of an argument-safe process API

Why this happens

The underlying bug is shell command construction from untrusted input. The vulnerable code passes attacker-influenced values to child_process.exec(), which invokes a shell and interprets shell control characters rather than treating each value solely as a data argument.

This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly called OS command injection. The insecure pattern is combining untrusted strings with a shell command instead of using safe argument separation and strict input constraints.

The underlying bug is shell command construction from untrusted input. The vulnerable code passes attacker-influenced values to child_process.exec(), which invokes a shell and interprets shell control characters rather than treating each value solely as a data argument.

This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, commonly called OS command injection. The insecure pattern is combining untrusted strings with a shell command instead of using safe argument separation and strict input constraints.

Potential impact

  • Attackers may execute arbitrary operating system commands
  • The Node.js process and its accessible data may be compromised
  • Credentials, tokens, or files available to the process could be exposed
  • The affected host or container could be altered or used for lateral movement
  • Service availability and image-processing workflows could be disrupted
  • Attackers may execute arbitrary operating system commands
  • The Node.js process and its accessible data may be compromised
  • Credentials, tokens, or files available to the process could be exposed
  • The affected host or container could be altered or used for lateral movement
  • Service availability and image-processing workflows could be disrupted

General mitigation guidance

Mitigation generally focuses on removing shell interpretation from image-conversion workflows and reducing trust in input values.

Common defensive patterns include:

  • Prefer process-spawning APIs that pass executable arguments separately rather than invoking a shell
  • Apply strict allowlists for permitted conversion formats, options, and filepath representations
  • Canonicalize and constrain file paths to approved directories
  • Avoid accepting conversion arguments directly from untrusted callers
  • Run image-processing operations with least-privilege accounts and isolated filesystem access
  • Limit available operating system capabilities and protect credentials from the conversion process

Validation should remain an additional control rather than the sole defense against command injection.

Mitigation generally focuses on removing shell interpretation from image-conversion workflows and reducing trust in input values.

Common defensive patterns include:

  • Prefer process-spawning APIs that pass executable arguments separately rather than invoking a shell
  • Apply strict allowlists for permitted conversion formats, options, and filepath representations
  • Canonicalize and constrain file paths to approved directories
  • Avoid accepting conversion arguments directly from untrusted callers
  • Run image-processing operations with least-privilege accounts and isolated filesystem access
  • Limit available operating system capabilities and protect credentials from the conversion process

Validation should remain an additional control rather than the sole defense against command injection.

How teams detect issues like this

Organizations can look for command-injection risks through:

  • Static analysis rules identifying child_process.exec() or equivalent shell APIs fed by request, file, or message data
  • Code review checks for string concatenation or interpolation when constructing operating system commands
  • Searches for image-conversion arguments that bypass typed, fixed argument boundaries
  • Runtime monitoring of unexpected child processes, shell invocation, and unusual ImageMagick activity
  • Policy enforcement that restricts shell execution from application services and build pipelines

Automated code-review and software-composition tools may help identify unsafe process-execution patterns, but findings should be validated against actual data flows.

Organizations can look for command-injection risks through:

  • Static analysis rules identifying child_process.exec() or equivalent shell APIs fed by request, file, or message data
  • Code review checks for string concatenation or interpolation when constructing operating system commands
  • Searches for image-conversion arguments that bypass typed, fixed argument boundaries
  • Runtime monitoring of unexpected child processes, shell invocation, and unusual ImageMagick activity
  • Policy enforcement that restricts shell execution from application services and build pipelines

Automated code-review and software-composition tools may help identify unsafe process-execution patterns, but findings should be validated against actual data flows.

Sources

SourceLink
gist.github.comgist.github.com/R3tro16/5a508fcfddfb0dfe66a0a53437ede74c
github.comgithub.com/enmaso/node-convert
github.comgithub.com/enmaso/node-convert/blob/143e4d76244e2daac57eef59d8ed5983e33ee4fb/convert.js#L4-L15
vulncheck.comvulncheck.com/advisories/enmaso-node-convert-through-1.0.0-os-command-injection-via-filepath-and-convertto

Frequently asked

questions

It can be remotely exploitable when a network-facing application exposes the affected conversion functionality and allows remote users to influence the vulnerable arguments. Local or internal deployments may require a different input path.

An attacker needs the ability to control or influence the filepath or convertTo values used to construct the ImageMagick command. The required access depends on how the package is integrated.

The safest pattern is to avoid shell-based command construction, pass executable arguments through a non-shell API, and enforce strict allowlists and path constraints.

Treat all command parameters as untrusted, prohibit unsafe shell APIs for dynamic input, review process-execution code paths, and run conversion services with minimal privileges and isolation.

It can be remotely exploitable when a network-facing application exposes the affected conversion functionality and allows remote users to influence the vulnerable arguments. Local or internal deployments may require a different input path.

An attacker needs the ability to control or influence the filepath or convertTo values used to construct the ImageMagick command. The required access depends on how the package is integrated.

The safest pattern is to avoid shell-based command construction, pass executable arguments through a non-shell API, and enforce strict allowlists and path constraints.

Treat all command parameters as untrusted, prohibit unsafe shell APIs for dynamic input, review process-execution code paths, and run conversion services with minimal privileges and isolation.

Find out what's already
exploitable in your codebase.