CVE-2026-68499
re2: Global `String.prototype.match` with an empty-matchable pattern never advances → infinite loop with unbounded native memory growth (DoS)
re2 provides Node.js bindings for Google's RE2 regular expression engine. Prior to 1.25.2, re2's String.prototype.match implementation with a global RE2 pattern that can match the empty string fails to advance its native matching cursor in lib/match.cc, causing an infinite loop and unbounded native memory growth that blocks the event loop and can exhaust host memory. This issue is fixed in 1.25.2.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
6.2
re2: Global `String.prototype.match` with an empty-matchable pattern never advances → infinite loop with unbounded native memory growth (DoS)
re2 provides Node.js bindings for Google's RE2 regular expression engine. Prior to 1.25.2, re2's String.prototype.match implementation with a global RE2 pattern that can match the empty string fails to advance its native matching cursor in lib/match.cc, causing an infinite loop and unbounded native memory growth that blocks the event loop and can exhaust host memory. This issue is fixed in 1.25.2.
- Record
CVE-2026-68499- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
EUVDEUVD-2026-51298
6.2
re2 provides Node.js bindings for Google's RE2 regular expression engine. Prior to 1.25.2, re2's String.prototype.match implementation with a global RE2 pattern that can match the empty string fails to advance its native matching cursor in lib/match.cc, causing an infinite loop and unbounded native memory growth that blocks the event loop and can exhaust host memory. This issue is fixed in 1.25.2.
- Record
EUVD-2026-51298- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-6hxr-mr5r-9836
6.2
re2: Global `String.prototype.match` with an empty-matchable pattern never advances → infinite loop with unbounded native memory growth (DoS)
Summary
String.prototype.match with a global RE2 collects all matches in a native loop that advances the cursor by the match length. A zero-width (empty) match has length 0, so the cursor never advances: the same empty match is found forever and appended to an ever-growing native vector. Any pattern that can match the empty string (a*, b?, x{0,3}, (a)|, (?:), …) therefore causes an infinite loop with unbounded memory growth. The call is synchronous native code, so it blocks the entire event loop and cannot be interrupted by try/catch, AbortController, --max-old-space-size, or timers — the process must be killed externally. This diverges from the built-in engine, where 'xxxx'.match(/a*/g) returns a finite array.
Root cause
// lib/match.cc:44 — global branch of WrappedRE2::Match
while (re2->regexp.Match(str, byteIndex, str.size, anchor, &match, 1)) {
groups.push_back(match);
byteIndex = match.data() - str.data + match.size(); // += 0 for a zero-width match
}
When match.size() == 0, byteIndex is unchanged, so the next iteration matches the same empty position again; groups grows without bound. The other iteration paths already guard this: lib/split.cc:50-55 advances by getUtf8CharSize on an empty match, and exec advances lastIndex. Only this global Match loop is missing the guard.
Proof of concept
const RE2 = require('re2');
'x'.match(new RE2('a*', 'g')); // never returns; grows memory until OOM
// also: 'b?', 'x{0,3}', '(a)|', 'c*d*', '(?:)'; empty subject '' triggers it too
Compare with the built-in engine, which terminates:
'xxxx'.match(/a*/g); // -> ["", "", "", "", ""]
Measured on a clean npm install [email protected] (latest), stock prebuilt binary: resident memory grew ~550 MB → 2.3 GB in ~3 seconds at 100% CPU, and the process had to be SIGKILLed externally.
Impact
Denial of service. Reachable remotely and without authentication wherever an application runs a global RE2 through String.prototype.match and either the pattern or the subject is attacker-influenced — e.g. a user-supplied regular expression, or a fixed empty-matchable pattern applied to user input. Because the loop blocks the event loop and exhausts memory in seconds, a single request can wedge a worker and, via memory exhaustion, affect the whole host.
Suggested fix
Mirror the empty-match handling already present in split.cc: when the match is zero-width, advance the cursor by one code point.
// lib/match.cc, inside the global while-loop
groups.push_back(match);
size_t off = match.data() - str.data;
if (match.size()) {
byteIndex = off + match.size();
} else {
byteIndex = off + (off < str.size ? getUtf8CharSize(str.data[off]) : 1);
}
Resolution
Fixed in re2 1.25.2.
The global match loop in lib/match.cc now advances the cursor by one Unicode
code point when a match is zero-width, so a pattern that can match the empty
string terminates with a finite result identical to the built-in engine
('xxxx'.match(/a*/g) returns five empty strings). This mirrors the guard
already present in split.
Remediation: upgrade to [email protected] or later.
Workaround (if you cannot upgrade): do not run a global RE2 through
String.prototype.match when the pattern is attacker-influenced or can match
the empty string. Iterate with matchAll/exec, or use the non-global form;
both already advanced the cursor correctly.
- Record
GHSA-6hxr-mr5r-9836- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
NVD
6.2
re2 provides Node.js bindings for Google's RE2 regular expression engine. Prior to 1.25.2, re2's String.prototype.match implementation with a global RE2 pattern that can match the empty string fails to advance its native matching cursor in lib/match.cc, causing an infinite loop and unbounded native memory growth that blocks the event loop and can exhaust host memory. This issue is fixed in 1.25.2.
- Record
CVE-2026-68499- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
OSV
6.2
re2: Global `String.prototype.match` with an empty-matchable pattern never advances → infinite loop with unbounded native memory growth (DoS)
re2 provides Node.js bindings for Google's RE2 regular expression engine. Prior to 1.25.2, re2's String.prototype.match implementation with a global RE2 pattern that can match the empty string fails to advance its native matching cursor in lib/match.cc, causing an infinite loop and unbounded native memory growth that blocks the event loop and can exhaust host memory. This issue is fixed in 1.25.2.
- Record
CVE-2026-68499- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-68499
6.2
re2 provides Node.js bindings for Google's RE2 regular expression engine. Prior to 1.25.2, re2's String.prototype.match implementation with a global RE2 pattern that can match the empty string fails to advance its native matching cursor in lib/match.cc, causing an infinite loop and unbounded native memory growth that blocks the event loop and can exhaust host memory. This issue is fixed in 1.25.2.
- Record
DEBIAN-CVE-2026-68499- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
OSVGHSA-6hxr-mr5r-9836
6.2
re2: Global `String.prototype.match` with an empty-matchable pattern never advances → infinite loop with unbounded native memory growth (DoS)
Summary
String.prototype.match with a global RE2 collects all matches in a native loop that advances the cursor by the match length. A zero-width (empty) match has length 0, so the cursor never advances: the same empty match is found forever and appended to an ever-growing native vector. Any pattern that can match the empty string (a*, b?, x{0,3}, (a)|, (?:), …) therefore causes an infinite loop with unbounded memory growth. The call is synchronous native code, so it blocks the entire event loop and cannot be interrupted by try/catch, AbortController, --max-old-space-size, or timers — the process must be killed externally. This diverges from the built-in engine, where 'xxxx'.match(/a*/g) returns a finite array.
Root cause
// lib/match.cc:44 — global branch of WrappedRE2::Match
while (re2->regexp.Match(str, byteIndex, str.size, anchor, &match, 1)) {
groups.push_back(match);
byteIndex = match.data() - str.data + match.size(); // += 0 for a zero-width match
}
When match.size() == 0, byteIndex is unchanged, so the next iteration matches the same empty position again; groups grows without bound. The other iteration paths already guard this: lib/split.cc:50-55 advances by getUtf8CharSize on an empty match, and exec advances lastIndex. Only this global Match loop is missing the guard.
Proof of concept
const RE2 = require('re2');
'x'.match(new RE2('a*', 'g')); // never returns; grows memory until OOM
// also: 'b?', 'x{0,3}', '(a)|', 'c*d*', '(?:)'; empty subject '' triggers it too
Compare with the built-in engine, which terminates:
'xxxx'.match(/a*/g); // -> ["", "", "", "", ""]
Measured on a clean npm install [email protected] (latest), stock prebuilt binary: resident memory grew ~550 MB → 2.3 GB in ~3 seconds at 100% CPU, and the process had to be SIGKILLed externally.
Impact
Denial of service. Reachable remotely and without authentication wherever an application runs a global RE2 through String.prototype.match and either the pattern or the subject is attacker-influenced — e.g. a user-supplied regular expression, or a fixed empty-matchable pattern applied to user input. Because the loop blocks the event loop and exhausts memory in seconds, a single request can wedge a worker and, via memory exhaustion, affect the whole host.
Suggested fix
Mirror the empty-match handling already present in split.cc: when the match is zero-width, advance the cursor by one code point.
// lib/match.cc, inside the global while-loop
groups.push_back(match);
size_t off = match.data() - str.data;
if (match.size()) {
byteIndex = off + match.size();
} else {
byteIndex = off + (off < str.size ? getUtf8CharSize(str.data[off]) : 1);
}
Resolution
Fixed in re2 1.25.2.
The global match loop in lib/match.cc now advances the cursor by one Unicode
code point when a match is zero-width, so a pattern that can match the empty
string terminates with a finite result identical to the built-in engine
('xxxx'.match(/a*/g) returns five empty strings). This mirrors the guard
already present in split.
Remediation: upgrade to [email protected] or later.
Workaround (if you cannot upgrade): do not run a global RE2 through
String.prototype.match when the pattern is attacker-influenced or can match
the empty string. Iterate with matchAll/exec, or use the non-global form;
both already advanced the cursor correctly.
- Record
GHSA-6hxr-mr5r-9836- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-835
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2026-68499
6.2
re2 provides Node.js bindings for Google's RE2 regular expression engine. Prior to 1.25.2, re2's String.prototype.match implementation with a global RE2 pattern that can match the empty string fails to advance its native matching cursor in lib/match.cc, causing an infinite loop and unbounded native memory growth that blocks the event loop and can exhaust host memory. This issue is fixed in 1.25.2.
- Record
UBUNTU-CVE-2026-68499- CVSS 3.1
- 6.2 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
re2npm |
through 1.25.1 | 1.25.2 |
node-re2Debian:12 |
All versions, plus listed versions 1.18.0+~cs2.13.8-11.19.2+~cs2.13.13-11.20.10+~cs2.13.13-11.20.12+~cs2.13.13-11.21.4+~cs2.13.13-1 Show 8 moreShow less1.21.4+~cs2.13.13-21.22.1+~cs1.3.5-11.23.3+~cs1.3.5-11.25.0+~cs1.6.0-11.25.0+~cs1.6.0-21.26.1+~cs1.7.0-11.26.1+~cs1.8.0-11.27.0+~cs1.8.1-1 |
None known |
node-re2Debian:13 |
All versions, plus listed versions 1.21.4+~cs2.13.13-21.22.1+~cs1.3.5-11.23.3+~cs1.3.5-11.25.0+~cs1.6.0-11.25.0+~cs1.6.0-21.26.1+~cs1.7.0-11.26.1+~cs1.8.0-11.27.0+~cs1.8.1-1 |
None known |
node-re2Debian:14 |
before 1.26.1+~cs1.7.0-1, plus listed versions 1.21.4+~cs2.13.13-21.22.1+~cs1.3.5-11.23.3+~cs1.3.5-11.25.0+~cs1.6.0-11.25.0+~cs1.6.0-2 |
1.26.1+~cs1.7.0-1 |
re2npm |
before 1.25.2 | 1.25.2 |
node-re2Ubuntu:20.04:LTS |
All versions, plus listed versions 1.10.4-11.10.5-11.10.5-1build1 |
None known |
node-re2Ubuntu:22.04:LTS |
All versions, plus listed versions 1.15.9+~cs1.8.18-11.15.9+~cs1.8.18-21.16.0+~cs2.12.8-21.17.1+~cs2.12.8-11.17.2+~cs2.13.8-11.17.3+~cs2.13.8-1 |
None known |
node-re2Ubuntu:24.04:LTS |
All versions, plus listed versions 1.18.0+~cs2.13.8-1build11.19.2+~cs2.13.13-1build11.20.10+~cs2.13.13-1 |
None known |
node-re2Ubuntu:26.10 |
All versions, plus listed versions 1.23.3+~cs1.3.5-11.25.0+~cs1.6.0-21.26.1+~cs1.7.0-1 |
None known |
node-re2Ubuntu:26.04:LTS |
All versions, plus listed versions 1.22.1+~cs1.3.5-11.22.1+~cs1.3.5-1build21.22.1+~cs1.3.5-1build31.23.3+~cs1.3.5-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-68499 is a medium vulnerability (CVSS 6.2) in Uhop Node-re2, published July 30, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.18%, the 8th percentile. Fixed in re2 1.25.2.
References
github.com/uhop/node-re2/security/advisories/GHSA-6hxr-mr5r-9836
github.com/uhop/node-re2/commit/56293de4fc0914d7bc35f92e98de25b0d9bb417d
github.com/uhop/node-re2/releases/tag/1.25.2
nvd.nist.gov/vuln/detail/CVE-2026-68499
github.com/advisories/GHSA-6hxr-mr5r-9836
github.com/CVEProject/cvelistV5/tree/main/cves/2026/68xxx/CVE-2026-68499.json