CVE-2022-24836: Nokogiri Inefficient Regular Expression Complexity
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.76617%
CWE
Published
4/11/2022
Updated
7/6/2023
KEV Status
No
Technology
Ruby
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
nokogiri | rubygems | < 1.13.4 | 1.13.4 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The GitHub commit diff shows a critical regex modification in Nokogiri::HTML4::Document.detect_encoding where the pattern was changed from /\A(<?xml[ \t\r\n]+[^>]>)/ to /\A(<?xml[ \t\r\n][^>]>)/ by removing the '+' quantifier. This quantifier caused exponential backtracking when processing inputs with many whitespace characters before the closing '>', leading to ReDoS. The vulnerability description explicitly references this encoding detection regex as the source of inefficiency, and the added test in the commit verifies the performance fix.