CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-Q53C-4PRM-W95Q

GHSA-q53c-4prm-w95q: Unix Home Directory Path Disclosure and Command Escaping Flaws in Shescape

Amit Schendel
Amit Schendel
Senior Security Researcher

Jul 25, 2026·6 min read·5 visits

Executive Summary (TL;DR)

A path disclosure flaw in shescape allows unescaped tilde expansions in Dash shell variable assignments, leaking user home directories. Secondary fixes address Zsh and Windows CMD injection points.

An escaping bypass in the npm package shescape on Unix platforms utilizing the Dash shell can result in unauthorized home directory path disclosure. The vulnerability occurs when user input containing specific sequences is passed inside shell variable assignment contexts. Additionally, the patch addresses secondary security gaps related to Zsh extended globbing and Windows CMD command block breakouts.

Vulnerability Overview

The npm package shescape serves as an escaping utility for Node.js applications, protecting shell command execution against parameter injections and unintended argument interpretation. Applications typically utilize this package to sanitize untrusted inputs before passing them to internal execution APIs.

This vulnerability, tracked under GHSA-q53c-4prm-w95q, describes a path disclosure flaw when executing within environments that use the Dash shell (either configured explicitly or operating as the system default). The bug permits an attacker to bypass shell escaping and force the system to expand shell-interpreted paths.

Simultaneously, the maintainers addressed secondary parsing weaknesses within Zsh and Windows CMD parsing routines. In Zsh, the presence of specific globbing control characters could alter pattern-matching behavior. Under Windows CMD, raw parenthetical delimiters were not correctly neutralized, allowing command block escapes.

Root Cause Analysis

In POSIX-compliant environments, Dash handles tilde expansion (~) by replacing it with the absolute path of the user's home directory. While this expansion normally occurs only at word boundaries or following whitespace, shell-specific variable assignments broaden this evaluation scope.

Inside a shell variable assignment context (e.g., VAR=val), the shell parses the assigned value and performs tilde expansion immediately following equals signs (=) or colons (:). This allows paths inside environment variable configurations like PATH to be dynamically resolved.

Prior to the security patch, shescape evaluated Dash-specific tildes using a restricted regular expression pattern: /(^|\s)~/g. This pattern only identified and escaped a tilde character if it appeared at the absolute beginning of the input string or immediately after a whitespace character.

Because the regex failed to recognize equals signs or colons as valid expansion boundaries, payloads containing characters like :~ bypassed the escaping mechanism. When integrated into a shell assignment command, Dash processed the unescaped tilde, resulting in sensitive system path disclosure.

Code Analysis

The technical fix was implemented across multiple internal libraries corresponding to each shell environment. In src/internal/unix/dash.js, the regex used to detect home directory tildes was updated to prevent assignment-context expansion.

@@ -16,7 +16,7 @@ export function getEscapeFunction() {
   const newlines = new RegExp(/\n/g);
   const backslashes = new RegExp(/\\/g);
   const comments = new RegExp(/(^|\s)#/g);
-  const home = new RegExp(/(^|\s)~/g);
+  const home = new RegExp(/(^|[\s:=])~/g);
   const specials = new RegExp(/(["$&'()*;<>?[\]`|])/g);
   const whitespace = new RegExp(/([\t ])/g);

Expanding the pattern to /(^|[\s:=])~/g ensures that tildes located after spaces, colons, or equals signs are properly escaped. This prevents Dash from recognizing the tilde as an expansion initiator within environment parameters.

In the Zsh escaping library src/internal/unix/zsh.js, the update consolidated various glob and expansion operators directly into the unconditional specials filter.

@@ -15,17 +15,15 @@ export function getEscapeFunction() {
   const controls = new RegExp(/[\0\u0008\r\u001B\u009B]/g);
   const newlines = new RegExp(/\n/g);
   const backslashes = new RegExp(/\\/g);
-  const comments = new RegExp(/(^|\s)#/g);
-  const expansions = new RegExp(/(^|\s)([=~])/g);
-  const specials = new RegExp(/(["$&'()*;<>?[\]`{|}])/g);
+  const expansions = new RegExp(/(^|[\s:=])=/g);
+  const specials = new RegExp(/(["#$&'()*;<>?[\]^`{|}~])/g);
   const whitespace = new RegExp(/([\t ])/g);

Moving #, ^, and ~ into the specials regex means they are now unconditionally backslash-escaped. This prevents glob execution when Zsh is configured with EXTENDED_GLOB enabled. For Windows CMD, parenthetical characters ( and ) were added to the specials regex inside src/internal/win/cmd.js to prevent command breakout.

Exploitation Methodology

To trigger the path disclosure vulnerability, an attacker must target an application utilizing a vulnerable version of shescape under a Dash shell environment. The resulting output must then be integrated directly into a variable assignment inside the executed shell command.

An attacker supplies the payload :~ through an untrusted input parameter. The escaping logic in shescape ignores this input sequence, returning the payload verbatim without applying backslash-escaping.

When the application processes this output dynamically into a command such as cp.execSync('VAR=' + escapedPayload), the resulting instruction evaluated by the shell is VAR=:~. The Dash parser evaluates this string inside the assignment block and expands the tilde.

// Proof-of-concept demonstrating path disclosure
import * as cp from "node:child_process";
import { Shescape } from "shescape";
 
const options = { shell: "dash" };
const shescape = new Shescape(options);
const payload = ":~";
const escapedPayload = shescape.escape(payload); 
 
// Returns vulnerable payload unmodified because of the regex gap
const result = cp.execSync(`V=${escapedPayload}; echo $V`, options);
console.log(result.toString());
// Vulnerable output leaks absolute user path: ":/home/node-user"

This bypass allows unauthorized extraction of path details, mapping the internal directory structure of the host container or server.

Impact Assessment

The primary outcome of exploiting this flaw is system information leakage (CWE-200). Exposing the home directory path reveals structural elements of the host environment, such as user account names and localized application paths.

This information exposure acts as a precursor for more severe exploitation chains. Attackers can leverage absolute path knowledge to fine-tune local file inclusion (LFI) attempts, target specific file paths during directory traversal, or weaponize secondary logical flaws.

For Windows environments, the parenthetical breakout addressed in the CMD patch carries a high security impact. If untrusted input is interpolated within a parenthetical block, an attacker can prematurely close the block and append arbitrary execution commands.

The vulnerability is rated with a CVSS v4 score of 6.3, highlighting its network-based delivery and low complexity, limited by specific shell execution requirements. Due to its registry-only advisory status, it does not have a traditional CVE index, causing potential gaps in signature-based scanner databases.

Remediation and Defensive Measures

The recommended resolution is updating the shescape library dependency to a secure release. For projects using the v2 release branch, update to 2.1.14 or later; for v3 installations, update to 3.0.1 or later.

If upgrading is not immediately possible, applications should pass dynamic parameters to child execution processes using environment variable dictionaries rather than string concatenation in a raw shell command.

// Secure parameter passing implementation
import * as cp from "node:child_process";
 
cp.execFile("task-executable", [], {
  env: { ...process.env, USER_INPUT: untrustedInput }
});

Additionally, applications can filter incoming inputs to block strings that contain tildes (~) or colons (:) preceding structural characters. Restricting the use of shell spawning and moving to safer parameter-based execution layers reduces the overall attack surface.

Official Patches

Eric Cornelissenv3 remediation commit for escaping vulnerabilities
Eric Cornelissenv2 remediation commit backport

Fix Analysis (2)

Technical Appendix

CVSS Score
6.3/ 10

Affected Systems

npm package shescape on Unix platforms utilizing Dash shellnpm package shescape on Unix platforms utilizing Zsh with EXTENDED_GLOBnpm package shescape on Windows platforms utilizing CMD

Affected Versions Detail

Product
Affected Versions
Fixed Version
shescape
Eric Cornelissen
< 2.1.142.1.14
shescape
Eric Cornelissen
>= 3.0.0, < 3.0.13.0.1
AttributeDetail
CWE IDCWE-116, CWE-200
Attack VectorNetwork
CVSS v4 Score6.3 (Medium)
Exploit StatusProof-of-Concept
KEV StatusNot Listed
ImpactInformation Disclosure / Arbitrary Command Execution

MITRE ATT&CK Mapping

T1082System Information Discovery
Discovery
T1083File and Directory Discovery
Discovery
T1059Command and Scripting Interpreter
Execution

Known Exploits & Detection

GitHub Security AdvisoryOfficial advisory proof-of-concept showing home directory disclosure in Dash

Vulnerability Timeline

Remediation commits push to GitHub repository
2026-07-22
Security Advisory GHSA-q53c-4prm-w95q published
2026-07-24
Patched versions released to npm registry
2026-07-24

References & Sources

  • [1]GitHub Security Advisory GHSA-Q53C-4PRM-W95Q
  • [2]Shescape Repository Advisory
  • [3]v3 Remediation Commit
  • [4]v2 Remediation Commit (Backport)
  • [5]v3 Remediation Pull Request
  • [6]v2 Remediation Pull Request
  • [7]v2.1.14 Release Notes
  • [8]v3.0.1 Release Notes
  • [9]Shescape Migration Documentation

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•14 minutes ago•GHSA-W4HW-QCX7-56PR
9.2

GHSA-W4HW-QCX7-56PR: OS Command Injection in Shescape via Unescaped Parentheses on Windows CMD

A critical command injection vulnerability in the shescape npm library affects Windows systems when running shell commands using cmd.exe. The escaping function fails to neutralize parentheses, allowing attackers to close shell blocks and execute arbitrary commands.

Amit Schendel
Amit Schendel
0 views•5 min read
•about 2 hours ago•GHSA-GM3R-Q2WP-HW87
8.7

GHSA-gm3r-q2wp-hw87: Quadratic-Time Denial of Service via Flag-Protection in Shescape

A high-severity algorithmic-complexity vulnerability in the Node.js library Shescape leads to a Quadratic-Time Denial of Service (DoS) when flag protection is enabled. By supplying inputs containing repetitive control characters and hyphens, remote attackers can trigger an inefficient nested loop in Shescape's argument-composition logic, blocking the Node.js single-threaded event loop and causing total application Denial of Service.

Amit Schendel
Amit Schendel
5 views•7 min read
•about 3 hours ago•GHSA-FP43-VJ7G-PG92
7.5

GHSA-FP43-VJ7G-PG92: Multi-Vector Security Vulnerabilities in OmniFaces JSF Utility Library

A multi-vector vulnerability advisory in the OmniFaces JavaServer Faces (JSF) utility library covers flaws leading to unauthenticated arbitrary file access, memory exhaustion (DoS), cross-site scripting (XSS), and WebSocket push channel hijacking.

Alon Barad
Alon Barad
6 views•5 min read
•about 4 hours ago•GHSA-FWJX-9P69-H25H
6.3

GHSA-FWJX-9P69-H25H: Terminal Escape Sequence Injection in Oh My Posh

Oh My Posh prior to version 29.35.1 is vulnerable to terminal escape sequence injection. Dynamic strings from directory names or Git repository metadata are written to the prompt output without neutralization, enabling unauthenticated remote code execution, clipboard hijacking, or terminal DoS when users navigate to malicious folders.

Amit Schendel
Amit Schendel
6 views•8 min read
•about 5 hours ago•GHSA-6XJ8-QV9J-XCJQ
7.8

GHSA-6XJ8-QV9J-XCJQ: Arbitrary Command Execution via Template Injection in Oh My Posh

A critical-severity template injection vulnerability in Oh My Posh allows for unauthenticated arbitrary command execution. This issue occurs when a user navigates their shell into a directory whose name contains malicious Go template syntax, which is subsequently parsed and executed by the prompt engine.

Amit Schendel
Amit Schendel
5 views•6 min read
•about 6 hours ago•GHSA-3R53-75J5-3G7J
5.6

GHSA-3r53-75j5-3g7j: Prototype Pollution in Quasar Framework extend Utility

A prototype pollution vulnerability (CWE-1321) in the Quasar framework's utility function 'extend' allows unauthenticated remote attackers to modify the global Object.prototype. This vulnerability can lead to application-level logic bypasses, denial of service, or potentially arbitrary code execution depending on downstream implementation.

Alon Barad
Alon Barad
8 views•6 min read