/

CVE-2026-32260

Severity:

HIGH RISK

(8.1)

Command Injection in Deno node:child_process Polyfill

CVE-2026-32260

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution and Sandbox Escape

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

A command injection vulnerability in Deno's node:child_process polyfill affects spawn and spawnSync when used with shell: true, due to incorrect quoting of shell arguments containing $VAR patterns.

If an attacker can control arguments passed into these APIs, they may execute arbitrary OS commands and bypass Deno's permission system in affected versions.

Affected context

This issue arises in Deno applications that:

  • Use the node:child_process polyfill (spawn / spawnSync) with shell: true
  • Pass user-influenced or otherwise untrusted strings as command arguments
  • Rely on Deno's permission system to constrain OS-level operations

The vulnerable behavior occurs during shell command construction in transformDenoShellCommand, where arguments containing $VAR patterns are quoted incorrectly for POSIX shells.

Exploit preconditions

  • Attack surface: Application code that invokes child_process.spawn or child_process.spawnSync with shell: true.
  • Required access: Ability to control or significantly influence one or more arguments passed to these functions (e.g., HTTP request parameters, CLI flags, environment-controlled inputs).
  • Trigger point: Execution of spawn/spawnSync in shell mode, where the constructed shell command is interpreted by sh or a compatible shell.
  • Why exploitation is possible: The argument sanitization logic wraps $VAR-containing arguments in double quotes instead of single quotes. In POSIX sh, double quotes still allow backtick command substitution, so malicious payloads using backticks can be executed despite the intended sanitization, enabling shell-level command injection and a path out of Deno's permission sandbox.

Why this happens

The root cause is a subtle quoting and prioritization bug in the shell command transformation logic (transformDenoShellCommand) used by the node:child_process polyfill.

A two-stage sanitization process attempts to neutralize special characters by quoting arguments, but when an argument contains a $VAR-like pattern, the code prefers double quotes over single quotes.

This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), because the sanitization does not fully neutralize shell metacharacters (notably backticks) under all conditions.

As a result, untrusted input is embedded into a shell command in a way that allows the shell to interpret portions of it as executable code.

Potential impact

  • Arbitrary OS command execution under the privileges of the Deno process
  • Bypassing or weakening of Deno's permission model and sandbox assumptions
  • Access to local files, network resources, or system utilities that the application is expected to be restricted from
  • Lateral movement within the host environment or container
  • Data exfiltration, tampering, or destruction on systems where the runtime is deployed

General mitigation guidance

Effective mitigation centers on eliminating untrusted input from shell command construction and avoiding shell-based execution paths:

  • Prefer non-shell execution: use APIs or libraries that invoke binaries directly without shell: true, and pass arguments as arrays rather than concatenated command strings.
  • Avoid shell: true for user-controlled operations; treat it as an exceptional case reserved for fully trusted inputs.
  • Apply strict input validation and allowlists for any values that must flow into shell commands (e.g., enumerated options, filenames matching constrained patterns).
  • Design code so that runtime-permission checks are complemented by application-level validation and do not assume the shell will safely interpret user data.
  • Encapsulate command execution behind narrowly scoped helper functions that enforce safe patterns, instead of scattering shell invocations throughout the codebase.

How teams detect issues like this

Detection typically involves both static and review-based approaches:

  • Static analysis: Flag uses of child_process.spawn / spawnSync with shell: true, especially where arguments trace back to HTTP request data, environment variables, command-line arguments, or other untrusted sources.
  • Code review patterns: During review, look for any shell command construction that uses string concatenation, template literals, or interpolation of untrusted values, and verify the quoting and escaping rules being relied upon.
  • Security linting rules: Configure linters or custom rules to warn on shell: true usage, and require justification or a security review for any exceptions.
  • Runtime monitoring: Where feasible, monitor executed command patterns (e.g., via audit logs) for anomalous or user-dependent commands that may indicate injection opportunities or exploitation.

Sources

SourceLink
github.comgithub.com/denoland/deno/security/advisories/GHSA-4c96-w8v2-p28j

Frequently asked

questions

It can be, if a remote user can influence the arguments passed into spawn or spawnSync with shell: true. Web APIs, bots, or services that pass request data into shell commands are particularly at risk.

The attacker must control or significantly influence the data that becomes a shell argument. This might be via HTTP parameters, CLI input, configuration values, or other user-supplied data that flows into the affected APIs.

The most robust pattern is to stop using shell: true for any operation involving untrusted data and instead call the intended program directly with an argument array. Where shell usage is unavoidable, strictly validate and constrain all inputs to known-safe values.

Treat shell execution as a high-risk operation: centralize it behind vetted helper functions, avoid building shell commands with interpolation, enforce strict input validation, and adopt static analysis or lint rules that flag unsafe patterns involving shell: true or user data in command strings.

Find out what's already
exploitable in your codebase.