CVE-2026-71498: node-re2 Out-of-Bounds Heap Read Vulnerability

re2 Updated 07 Aug 2026

Summary

06/08/2026
Yes i
Moderate
5.1

CVE-2026-71498: re2 infers a character's byte length from its UTF-8 lead byte alone, with no bound on the bytes actually remaining in the input. Affects re2 versions < 1.26.1. Fixed in 1.26.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The 're2' package is a popular JavaScript library that provides a fast and efficient way to work with regular expressions. It is widely used in Node.js applications for pattern matching and string manipulation. However, a vulnerability has been identified that allows for an out-of-bounds heap read when using Buffer inputs, potentially exposing sensitive adjacent memory to JavaScript.

Vulnerability Detail

The vulnerability arises from the way 're2' infers the byte length of a character from its UTF-8 lead byte without considering the actual size of the input. This can lead to reading beyond the end of a Buffer, resulting in the disclosure of adjacent heap memory. Specifically, functions like 'replace' and 'split' can inadvertently return more bytes than were supplied, including sensitive data from memory. This issue is deterministic and does not require special conditions to exploit, making it a significant risk for applications that handle untrusted input.

How To Fix

Latest published version: 1.27.0 as of 23 Oct 2026

npm install re2@1.27.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.26.1

This is the first release that contains the fix.

npm install re2@1.26.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading is not immediately possible, consider using strings instead of Buffers when calling 'replace', 'split', or the 'RE2' constructor. Additionally, you can validate that Buffer input is well-formed UTF-8 before processing it. For example, you can use the following code to check if a Buffer is valid UTF-8:

const isValidUtf8 = (buf) => Buffer.compare(Buffer.from(buf.toString('utf8')), buf) === 0;

if (isValidUtf8(myBuffer)) {
    // Safe to use myBuffer
}

Conclusion

The vulnerability CVE-2026-71498 in the 're2' package poses a risk of information disclosure through out-of-bounds heap reads when using Buffer inputs. It is crucial to upgrade to version 1.26.1 or later to mitigate this risk. Additionally, implementing workarounds can help protect applications until an upgrade is feasible.

See every vulnerability recorded for re2 →

Share this vulnerability

FAQ

The CVSS score for this vulnerability is 5.1, indicating a moderate severity level.

Only Buffer inputs are affected. String inputs are not at risk due to re-encoding that ensures well-formed UTF-8.

Yes, it can disclose up to 3 bytes of adjacent heap memory to JavaScript, which may include sensitive information.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Check your application against this vulnerability using the Vulert playground at Vulert Scanner.

You can implement workarounds such as using strings instead of Buffers or validating Buffer inputs to ensure they are well-formed UTF-8.

Related vulnerabilities

Recent vulnerabilities recorded for re2.

How To Fix

Latest published version: 1.27.0 as of 23 Oct 2026

npm install re2@1.27.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.26.1

This is the first release that contains the fix.

npm install re2@1.26.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback