/

CVE-2026-49402

Severity:

HIGH RISK

(8.1)

OS Command Injection (CWE-78) in Deno child_process API

CVE-2026-49402

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(8.1)

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

Deno's node:child_process implementation prior to 2.7.10 incorrectly escaped command-line arguments when shell: true was used, leaving Windows cmd.exe metacharacters and % expansion unneutralized.

If an attacker can influence any portion of arguments passed to spawn, spawnSync, exec, or similar calls with shell: true, they could inject arbitrary commands into the resulting cmd.exe invocation.

Affected context

This vulnerability occurs in applications built on Deno that rely on the node:child_process API with shell: true on Windows systems.

It becomes relevant when user-controlled or environment-derived data is incorporated into command arguments that are passed through escapeShellArg() to cmd.exe.

The issue is limited to contexts where Deno code constructs shell commands dynamically and depends on the runtime to safely escape arguments, rather than using safer non-shell invocation patterns.

Exploit preconditions

  • Attack surface: Deno applications that invoke node:child_process with shell: true on Windows.
  • Required access: Ability to control or influence any part of the arguments passed to spawn/spawnSync/exec or similar functions (e.g., via HTTP input, CLI parameters, configuration, or environment variables).
  • Trigger point: Execution of a child_process call that builds a command line using escapeShellArg() and launches cmd.exe.
  • Why exploitation is possible: The escaping helper does not properly quote cmd.exe metacharacters and fails to neutralize %, allowing cmd.exe to treat attacker-controlled input as additional command syntax or variable expansion rather than a literal argument.

Why this happens

The underlying bug is an OS command injection pattern where untrusted data is combined into a shell command without adequate neutralization of shell control characters.

Specifically, the escapeShellArg() helper used by Deno's node:child_process implementation on Windows incorrectly assumes that double-quoting is sufficient, overlooking cmd.exe-specific metacharacters and % expansion semantics.

This aligns with CWE-78: OS Command Injection, in which application code delegates untrusted input directly into shell parsing logic, allowing the shell to interpret it as executable commands instead of inert data.

Potential impact

  • An attacker may execute arbitrary commands under the privileges of the Deno process.
  • Application data and configuration could be read, modified, or deleted via injected commands.
  • The host system could be further compromised, enabling lateral movement or persistence.
  • Logging, audit records, or other security controls can be tampered with through malicious command execution.

General mitigation guidance

Effective mitigation focuses on eliminating unsafe shell composition and reducing trust in external input.

Common defensive patterns include:

  • Prefer non-shell invocation (e.g., passing arguments as structured arrays to subprocess APIs) instead of shell: true, especially on Windows.
  • Avoid constructing command strings from user or environment input; treat such data as parameters, not command fragments.
  • Introduce strict validation and normalization on any data that must influence command-line arguments, rejecting unexpected characters and patterns.
  • Run applications and child processes with least privilege to limit the impact of any command execution.
  • Separate responsibilities so that code performing system-level operations has narrowly defined, audited entry points and minimized exposure to untrusted inputs.

How teams detect issues like this

Detection typically relies on identifying insecure command construction and shell usage patterns in code.

Useful approaches include:

  • Static analysis rules that flag child_process calls using shell: true, especially when arguments derive from request data, configuration files, or environment variables.
  • Code review practices that scrutinize any string concatenation or interpolation used to build commands, looking for cmd.exe metacharacters and % in user-influenced data flows.
  • Policy enforcement in CI pipelines that disallow or require justification for shell-based subprocess calls and encourage parameterized, non-shell process spawning.
  • Optional use of automated security scanners that understand OS command injection patterns and can highlight risky escaping logic in cross-platform runtimes like Deno.

Sources

SourceLink
github.comgithub.com/denoland/deno/security/advisories/GHSA-7xh3-mhg9-jcw8

Frequently asked

questions

It can be, depending on the application. If remote users can influence any arguments passed to child_process calls with shell: true, remote command injection is possible over network interfaces.

The attacker needs the ability to control or significantly influence data that becomes part of a shell command line, such as request parameters, CLI arguments, configuration values, or environment variables that feed into child_process calls.

The safest approach is to avoid shell: true and shell command strings altogether, using non-shell subprocess APIs that accept arguments as structured arrays, combined with strict validation and least-privilege execution for any spawned processes.

Establish development guidelines that prohibit building shell commands from untrusted input, adopt static analysis rules targeting shell usage, and require code reviews to validate that all process-spawning logic uses parameterized, non-shell patterns wherever possible.

Find out what's already
exploitable in your codebase.