{"id":"CVE-2026-73413","aliases":["CVE-2026-73413","GHSA-gm3r-q2wp-hw87"],"related":[],"kind":"vulnerability","state":"published","title":"Shescape: Quadratic-time denial of service in flag-protection","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nThis impacts users of Shescape that have flag protection enabled, which is on by default, regardless of the API being used.\n\nAn attacker can cause a runtime quadratic in the input size, causing denial of service for large inputs.\n\n```javascript\nimport { Shescape } from \"shescape\";\n\n// 1. Prerequisites\nconst options = {\n    //flagProtection unspecified\n    // Or\n    flagProtection: true,\n};\n\n// 2. Payload\nlet payload = \"\\u0000-\".repeat(32000);\n\n// 3. Usage\nconst shescape = new Shescape(options);\nlet callback;\n\ncallback = () => shescape.escape(payload);\n// Or\ncallback = () => shescape.escapeAll([payload]);\n// Or\ncallback = () => shescape.quote(payload);\n// Or\ncallback = () => shescape.quoteAll([payload]);\n\nconst t0 = process.hrtime.bigint();\ncallback();\nconst ms = Number(process.hrtime.bigint() - t0) / 1e6;\n\n// 4. Impact\nconsole.log(\"Duration:\", ms);\n// Outputs \"Duration:\" followed by a number close to 20000\n```\n\n### Patches\n\nThis bug has been patched in [v2.1.14] and [v3.0.1] which you can upgrade to now.\n\nIf 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.\n\nNo patches will be released for version of Shescape lower than v2.0.0.\n\n### Workarounds\n\nAlternatively, users of Shescape can 1) put restrictions on the length of untrusted input or 2) strip all content before the **last** `-` from untrusted inputs.\n\n### For more information\n\n- Comment on Pull Request [#2651] for v2 and [#2649] for v3\n- Comment on commit [b4b34c3] for v2 and [43d70b5] for v3\n- Open an issue at <https://github.com/ericcornelissen/shescape/issues> (New issue > Question)","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-07-24T22:35:08.000Z","modified":"2026-10-24T15:10:00.190Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"}],"cwes":["CWE-400","CWE-407"],"affected":[{"ranges":[{"version":">= 2.1.11, < 2.1.14","status":"affected"},{"version":">= 3.0.0, < 3.0.1","status":"affected"}],"vendor":"ericcornelissen","product":"shescape","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.1.11","status":"affected","fixed":"2.1.14"}],"ecosystem":"npm","package":"shescape","purl":"pkg:npm/shescape","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"3.0.0","status":"affected","fixed":"3.0.1"}],"ecosystem":"npm","package":"shescape","purl":"pkg:npm/shescape","source":"ghsa"}],"references":[{"url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-gm3r-q2wp-hw87","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/pull/2649","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/pull/2651","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/commit/43d70b59d09bbe5c3fd02ef08b3a123e977ed9de","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/commit/b4b34c394e7f9da2775bb75381066b9a228c425f","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v2.1.14","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v3.0.1","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ericcornelissen/shescape","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/ericcornelissen/shescape/blob/dea8893a5877893d8d4923dbf253080e08899e6d/docs/migration.md","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-08-13T14:17:17.539Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-73413","url":"https://www.cve.org/CVERecord?id=CVE-2026-73413","licence":"CVE Terms of Use","modified":"2026-08-13T14:18:12.252Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-gm3r-q2wp-hw87","url":"https://github.com/advisories/GHSA-gm3r-q2wp-hw87","licence":"CC-BY-4.0","modified":"2026-08-12T19:59:13.755Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-73413","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-73413","licence":"Public domain","modified":"2026-10-24T15:10:00.190Z"}],"updatedAt":"2026-11-25T22:59:32.647Z","epss":{"score":0.00336,"percentile":0.28878,"date":"2026-12-01T12:00:22.000Z"}}