Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. @chenglou/pretext
  4. ›
  5. GHSA-5478-66c3-rhxr

GHSA-5478-66c3-rhxr: Pretext: Algorithmic Complexity (DoS) in the text analysis phase

April 8, 2026

isRepeatedSingleCharRun() in src/analysis.ts (line 285) re-scans the entire accumulated segment on every merge iteration during text analysis, producing O(n²) total work for input consisting of repeated identical punctuation characters. An attacker who controls text passed to prepare() can block the main thread for ~20 seconds with 80KB of input (e.g., "(".repeat(80_000)).

Tested against commit 9364741d3562fcc65aacc50953e867a5cb9fdb23 (v0.0.4) on Node.js v24.12.0, Windows x64.

A standalone PoC and detailed write-up are attached below.


References

  • github.com/advisories/GHSA-5478-66c3-rhxr
  • github.com/chenglou/pretext
  • github.com/chenglou/pretext/releases/tag/v0.0.5
  • github.com/chenglou/pretext/security/advisories/GHSA-5478-66c3-rhxr

Code Behaviors & Features

Detect and mitigate GHSA-5478-66c3-rhxr with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 0.0.5

Fixed versions

  • 0.0.5

Solution

Upgrade to version 0.0.5 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-407: Inefficient Algorithmic Complexity

Source file

npm/@chenglou/pretext/GHSA-5478-66c3-rhxr.yml

Spotted a mistake? Edit the file on GitLab.

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

Page generated Sun, 08 Nov 2026 00:15:26 +0000.