Executive brief
A vulnerability in the node-re2 library, which provides high-performance regular expression support for Node.js, could allow an attacker to read small amounts of sensitive information from the computer's memory. By providing specially crafted data (specifically a Buffer ending in a partial character), an attacker can trick the software into reading past the end of the intended data and returning adjacent memory contents. This could lead to the exposure of fragments of other data processed by the application, potentially impacting privacy and security.
Technical details
The node-re2 library suffers from an out-of-bounds (OOB) heap read vulnerability in its native C++ layer. The `getUtf8CharSize` function determines character length based solely on the lead byte without verifying the actual remaining buffer length. When a `Buffer` object (which is passed to the native layer without re-encoding) ends with a multi-byte UTF-8 lead byte but lacks the necessary continuation bytes, functions like `replace()` and `split()` will read up to 3 bytes past the buffer boundary. These adjacent heap bytes are then copied into the resulting JavaScript object, allowing for deterministic information disclosure. The vulnerability is fixed in version 1.26.1 by clamping the inferred character size to the actual remaining input length.
Affected products
- uhop re2 <= 1.26.0
Timeline
- 2026-07-21: disclosed: Reported by OvOhao
- 2026-08-06: advisory: GitHub Advisory published
- 2026-08-06: patched: Fixed in version 1.26.1