RubySec

Providing security resources for the Ruby community

CVE-2026-79770 (nokogiri): Nokogiri CSS selector tokenizer has regular expression backtracking

Nokogiri CSS selector tokenizer has regular expression backtracking

Published: May 06, 2026

SECURITY IDENTIFIERS

GEM

nokogiri

SEVERITY

CVSS v3.x: 7.5 (High)

PATCHED VERSIONS

>= 1.19.3

DESCRIPTION

Summary

Nokogiri's CSS selector tokenizer contains regular expressions whose construction may result in exponential regex backtracking on adversarial selectors. Three ReDoS vectors are addressed in this release:

  1. String-literal tokenization on certain unterminated quoted-string input.
  2. String-literal tokenization on a separate class of hex-escape-rich input.
  3. Identifier tokenization on hex-escape-rich input.

The public CSS selector methods that funnel through the affected tokenizer are Nokogiri::CSS.xpath_for, Node#css, Node#at_css, Searchable#search, and CSS::Parser#parse.

Credit

Vector 1 was responsibly reported by @colby-swandale. Vectors 2 and 3 were discovered by @flavorjones during the response to the original report.

RELATED