CVE-2026-73411
JSON

6.3medium

Shescape: Home-directory disclosure in assignment context on Unix with Dash

Severity
6.3medium CVSS:4.0 by GitHub_M
Exploit likelihood
0.34% (higher than 28% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-q53c-4prm-w95q

Description

Shescape is a simple shell escape library for JavaScript. Prior to 2.1.14 and 3.0.1, getEscapeFunction in src/internal/unix/dash.js fails to escape ~ after : or = when applications use the escape or escapeAll APIs on Unix with shell set to dash, or with shell set to true when Dash is the default, and interpolate the result into an assignment prefixed to a command. An attacker who controls the input can supply a value such as :~ to disclose the home-directory path and may change the location on which the command operates. This issue is fixed in versions 2.1.14 and 3.0.1.

Affected

Product or packageVersionsReported by
ericcornelissen shescape< 2.1.14, >= 3.0.0, < 3.0.1CVE List
shescape (npm)before 2.1.14, from 3.0.0 before 3.0.1GitHub Advisory Database

All scores

GitHub_M6.3medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Classification

CWE-116CWE-200

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Shescape is a simple shell escape library for JavaScript. Prior to 2.1.14 and 3.0.1, getEscapeFunction in src/internal/unix/dash.js fails to escape ~ after : or = when applications use the escape or escapeAll APIs on Unix with shell set to dash, or with shell set to true when Dash is the default, and interpolate the result into an assignment prefixed to a command. An attacker who controls the input can supply a value such as :~ to disclose the home-directory path and may change the location on which the command operates. This issue is fixed in versions 2.1.14 and 3.0.1.

GitHub Advisory Database
Impact

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
Patches

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.

Workarounds

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.

For more information
NVD (es)

Shescape es una simple biblioteca de escape de shell para JavaScript. Antes de las versiones 2.1.14 y 3.0.1, getEscapeFunction en src/internal/unix/dash.js no logra escapar ~ después de : o = cuyo las aplicaciones usan las API escape o escapeAll en Unix con el shell configurado como dash, o con el shell configurado como true cuyo Dash es el predeterminado, e interpolan el resultado en una asignación prefijada a un comyo. Un atacante que controla la entrada puede proporcionar un valor como :~ para revelar la ruta del directorio de inicio y puede cambiar la ubicación en la que opera el comyo. Este problema está solucionado en las versiones 2.1.14 y 3.0.1.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-73411 changed 2026-08-12CVE Terms of Use
GitHub Advisory DatabaseGHSA-q53c-4prm-w95q changed 2026-08-12CC-BY-4.0
NVDCVE-2026-73411 changed 2026-10-24Public domain