High · 7.5 Node.js & npm CVE-2026-116795 GHSA-gg6h-894w-4m9c
RE2JS Denial-of-Service Flaw: Quadratic-Time Lookbehind Matching (CVE-2026-116795)
A denial-of-service vulnerability in the re2js regular expression engine allows attacker-controlled input to trigger quadratic-time processing when lookbehind assertions are used with repeated matching, potentially exhausting a worker thread. Fixed in version 2.8.7.
By PatchBriefing ·
Produced automatically from official sources with the help of AI. How we work →
AI summary
A vulnerability has been disclosed in re2js, the JavaScript port of the RE2 regular expression engine, which is designed to guarantee linear-time matching. The issue, tracked as CVE-2026-116795, breaks that guarantee under specific conditions involving lookbehind assertions, allowing an attacker to cause excessive CPU consumption through crafted input.
What Happened
A quadratic-time complexity issue was identified in re2js when lookbehind assertions (LOOKBEHINDS) are enabled in combination with repeated matching operations such as matcher().find(), matchAll(), split(), or matcher().replaceAll(). Under these conditions, the engine's internal matching routine (Machine.match) restarts lookbehind scanning from offset zero for every requested start position. In addition, Matcher-based APIs request capture slots, which disables an early-exit optimization normally available for captureless matching. The combined effect is that dense matches cause the input to be repeatedly rescanned, producing quadratic total work instead of the linear-time behavior RE2-based engines are designed to provide.
Technical Cause
The root cause is algorithmic: the restart-from-zero behavior in lookbehind scanning, combined with the loss of the early-exit optimization when capture slots are requested, allows carefully structured or dense input to force repeated rescans of the same text. This is classified as CWE-407 (Inefficient Algorithmic Complexity).
Why It Matters
Because the vulnerability can be triggered remotely, without authentication, and without any user interaction, an attacker who can supply input to a regular expression using lookbehind assertions in a vulnerable application could cause a single-threaded worker to become monopolized, resulting in denial of service. The vulnerability does not affect confidentiality or integrity, only availability.
Who Is Affected
Applications using the re2js npm package that enable lookbehind assertions and perform repeated matching via matcher().find(), matchAll(), split(), or matcher().replaceAll() are affected. No other products are named in the available facts.
Affected Versions
re2js versions from 2.2.0 up to, but not including, 2.8.7 are affected.
Fixes and Mitigation
The issue is fixed in re2js version 2.8.7. Users of affected versions should upgrade to version 2.8.7.
Recommended Action
Update the re2js package to version 2.8.7 as soon as feasible, particularly if your application uses lookbehind assertions together with repeated matching operations. No workaround other than upgrading is described in the available facts.
PatchBriefing score
7.5 / 10 · High
Official CVSS: 7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
EPSS 0.0063 (45 percentile)
Why this score
The PatchBriefing score equals the official CVSS score; when this article covers several vulnerabilities, the highest one. Signals such as known exploitation and EPSS are listed separately and do not change the score.
Affected versions
- re2js >= 2.2.0, < 2.8.7
- vulnerable
- re2js ≥ 2.2.0 < 2.8.7
- vulnerable
- ≥ 2.8.7
- patched
Reported fixes
The issue is fixed in re2js version 2.8.7. Users of affected versions should upgrade to version 2.8.7.
How this was built
3 source records were collected, matched and used to prepare the report above.
-
NVD (NIST) database
-
GitHub Advisory Database database
-
OSV.dev database
Revision history
- Published
- Generated