---
id: "CVE-2026-116795"
kind: "vulnerability"
aliases: ["CVE-2026-116795"]
title: "RE2JS: lookbehind regex matching becomes quadratic, enabling denial of service"
severity: "high"
cvss: 7.5
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["javascript", "node", "package", "re2js", "self-hosted"]
not_affected_if: ["default-config", "trusted-input-only"]
published_at: "2026-10-28T18:17:14+00:00"
first_seen_at: "2026-10-28T18:34:33+00:00"
updated_at: "2026-10-28T18:34:50+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-116795", "first_seen_at": "2026-10-28T18:34:33+00:00"}]
---

# RE2JS: lookbehind regex matching becomes quadratic, enabling denial of service

RE2JS, the JavaScript port of Google's RE2 regex engine, rescans input from the start for each match when lookbehinds are enabled and matcher-based APIs are used. Attacker-controlled text with many dense matches can tie up a single-threaded worker and deny service.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the installed re2js version in package.json or the lockfile, for example `npm ls re2js`
- Search the code for `LOOKBEHINDS` or `matcher().find()`, `matchAll()`, `split()`, `replaceAll()` used with RE2JS on untrusted input

## Fix

- Upgrade re2js to `2.8.7` or later

## Timeline

- 2026-10-28T18:34:33+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-116795

## From the sources

RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching. From 2.2.0 until 2.8.7, enabling LOOKBEHINDS and using repeated matching through matcher().find(), matchAll(), split(), or matcher().replaceAll() can cause quadratic total work. Machine.match restarts lookbehind scanning from offset zero for each requested start position, while Matcher-based APIs request capture slots that prevent the early exit used for captureless matching. Dense matches therefore repeatedly rescan the input, allowing attacker-influenced text to monopolize a single-threaded worker and deny service. This issue is fixed in version 2.8.7.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
