/

CVE-2026-22864

Severity:

HIGH RISK

(8.1)

Command Injection in Deno Process Spawning on Windows

CVE-2026-22864

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-77

Impact:

Execution of Unintended System Commands on Windows

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 issue in Deno's Windows process spawning logic allows batch or shell files to be executed when their extensions use alternate casing (for example .BAT or .Bat), bypassing a case-sensitive block that only checked for lowercase .bat and .cmd.

In environments that rely on Deno's restriction to prevent spawning batch/shell files, an attacker who can influence the path or executable name may be able to execute unintended commands on Windows systems.

Affected context

This vulnerability affects Deno applications running on Windows that:

  • Depend on Deno APIs for spawning child processes (for example utilities, CLIs, or server-side scripts), and
  • Rely on Deno's built-in protection to block .bat/.cmd execution instead of enforcing their own validation or restrictions.

The issue arises specifically when the spawned program is a Windows batch or command file whose extension is not strictly lowercase .bat or .cmd, allowing the intended restriction to be bypassed.

Exploit preconditions

  • Attack surface: Windows systems running Deno where untrusted or partially trusted input influences which executable or script is spawned.
  • Required access: Ability to provide or control the path/command passed to Deno's process-spawning functionality (e.g., user-supplied arguments, configuration, environment variables).
  • Trigger point: Invocation of a Deno API (such as process spawning) that attempts to block .bat/.cmd but performs a case-sensitive comparison against only lowercase extensions.
  • Why exploitation is possible: The extension check is case-sensitive and only matches .bat and .cmd, so Windows batch files using alternate casing (e.g., script.BAT) are not blocked and can be executed, despite the intended restriction.

Why this happens

The underlying bug is an incomplete validation of command execution targets, mapped to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').

Deno's security control to prevent spawning Windows batch/shell files relies on string comparison of file extensions against lowercase .bat and .cmd. Because the comparison is case-sensitive and Windows filesystems and command resolution treat .BAT, .Bat, etc. as equivalent, the protection fails for alternate casings. This mismatch between validation logic and the operating system's case-insensitive behavior creates a gap where attacker-controlled paths with differently cased extensions can bypass the intended command execution restriction.

Potential impact

  • Bypass of application-level or platform-level restrictions intended to prevent batch/shell execution.
  • Execution of unintended Windows batch or command scripts with the privileges of the Deno process.
  • Potential command injection when user-controlled input selects or influences which script is spawned.
  • Escalation of impact of other vulnerabilities that rely on Deno's spawning behavior for containment.

General mitigation guidance

Effective mitigation centers on robust, OS-consistent validation of spawned commands and defense-in-depth around process creation:

  • Normalize extensions and paths before validation (e.g., convert to a canonical case) so checks align with Windows' case-insensitive behavior.
  • Apply allowlist-based execution policies, restricting process spawning to a small set of trusted executables and disallowing script-like targets by default.
  • Avoid delegating untrusted or partially trusted input directly into process-spawning APIs; introduce explicit mapping layers instead of passing user-specified commands.
  • Run Deno applications with least-privilege accounts and minimize the ability of the process to access or create executable script files in untrusted locations.
  • Combine application-level restrictions with OS-level policies (such as AppLocker or similar) to limit script execution across the system.

How teams detect issues like this

Security teams can look for this class of issue using a combination of static, code review, and policy-based approaches:

  • Static analysis/code scanning: Flag code that passes user-controlled input or file paths directly into Deno process-spawning APIs without normalization and strict allowlisting.
  • Manual code review: Examine security controls around process spawning, checking for case-sensitive extension comparisons on Windows and ensuring logic matches OS semantics.
  • Configuration and policy enforcement: Use CI/CD checks or linters to enforce patterns such as canonicalizing file extensions and applying explicit allowlists before spawning processes.
  • Runtime monitoring: Observe process creation logs on Windows for unexpected batch or command invocations originating from Deno-managed processes, focusing on unusual casing or paths.

Sources

SourceLink
github.comgithub.com/denoland/deno/releases/tag/v2.5.6
github.comgithub.com/denoland/deno/security/advisories/GHSA-m3c4-prhw-mrx6

Frequently asked

questions

It can be, if a Deno application exposes a remote interface (such as an HTTP API or CLI wrapper) that allows remote users to influence which commands or paths are spawned on a Windows system. Exploitability depends on how much control an attacker has over the spawned process parameters.

An attacker needs the ability to influence the command, path, or script name that Deno spawns—directly or indirectly. This could occur through user-input parameters, configuration files, or any data flow that affects process-spawning APIs on Windows.

Normalize file extensions and paths before checking them, enforce a strict allowlist of permitted executables, and avoid relying on case-sensitive comparisons on Windows. Treat any user-influenced command spawning as high-risk and wrap it in explicit validation and canonicalization logic.

Design process-spawning paths assuming that user input is untrusted, apply canonicalization before validation, and prefer allowlists over blocklists. Incorporate security reviews and automated checks that specifically look for OS command execution paths and verify they are aligned with the underlying platform's case and path semantics.

Find out what's already
exploitable in your codebase.