Nokogiri CSS Selector Tokenizer Vulnerability: Regular Expression Denial of Service

nokogiri Updated 02 Sep 2026

Summary

25/08/2026
HIGH
No i
High
7.5

GHSA-5jhf-fpp7-v2pv: Duplicate Advisory: Nokogiri CSS selector tokenizer has regular expression backtracking. Affects nokogiri versions 1.0.0 – 1.9.1. No fix is published. 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Nokogiri is a widely-used Ruby library for parsing HTML and XML. It provides a simple and efficient way to manipulate and search documents using CSS selectors and XPath. However, versions prior to 1.19.3 are vulnerable to a specific denial of service attack due to issues in the CSS selector tokenizer, which can be exploited by attackers to cause significant performance degradation.

Vulnerability Detail

The vulnerability arises from regular expression backtracking in the CSS selector tokenizer of Nokogiri versions before 1.19.3. Attackers can craft malicious CSS selectors that, when processed by methods like Node#css, Node#at_css, and Searchable#search, lead to exponential backtracking in regex processing. This can result in denial of service, making the application unresponsive and affecting user experience.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If you cannot update Nokogiri immediately, consider sanitizing user input to prevent the injection of malicious CSS selectors. Implementing strict validation on the input can help mitigate the risk until an update can be applied.

Conclusion

The Nokogiri CSS selector tokenizer vulnerability poses a significant risk due to its potential for denial of service attacks. It is crucial for users of Nokogiri to update to version 1.19.3 or later to mitigate this risk. Additionally, employing input validation can serve as a temporary workaround until the update is applied.

See every vulnerability recorded for nokogiri →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 7.5, indicating a high severity level.

Nokogiri versions prior to 1.19.3 are affected by this vulnerability.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without any signup.

Exploitation of this vulnerability can lead to denial of service, causing the application to become unresponsive and negatively impacting user experience.

Yes, you can implement input validation to sanitize user inputs and prevent the injection of malicious CSS selectors as a temporary measure.

Related vulnerabilities

Recent vulnerabilities recorded for nokogiri.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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