Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-68499 — re2

🟡 CVSS 6.2 — Medium ✅ No Known Exploit CWE-835 NVD
6.2
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

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

```cpp

// 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

```js

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:

```js

'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.

```cpp

// 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.

How this vulnerability can be exploited

This issue can be reached with local access to the system, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality none, integrity none, availability high.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

  • Attack vector: Local — a local account, shell or session on the host is needed.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: None — nobody has to be tricked into anything.
  • Scope: Unchanged — the damage stays inside the vulnerable component.
  • Confidentiality impact: None.
  • Integrity impact: None.
  • Availability impact: High — total loss, or loss the attacker controls.

Weakness class

CVE-2026-68499 is classified as CWE-835: Infinite Loop. A loop condition can never become false for some inputs, hanging the process.

Affected software

CVE-2026-68499 is recorded against 2 packages.

  • re2
  • unknown

Timeline and source

Published on 31 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Package)
github.com (Web)

Other advisories for this package

re2 has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-835: Infinite Loop) in other software:

Details

Severity Medium
CVSS Score 6.2
CVSS Vector CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CWE CWE-835
Public Exploit ✅ No
Source NVD
Published 2026-07-31
Updated 2026-08-20
Modified 2026-07-31
Fix URL N/A

Affected Packages

Software From version Fixed in
re2 — —
unknown — —

Similar Threats

Vulnerability Monitoring

Track new vulnerabilities in re2

CVE-2026-68499 is rated CVSS 6.2 Medium. BotEraser monitors your WordPress installation and notifies you when software you use appears in our vulnerability database.

Set Up Free Alerts →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026
✓