GHSA-5PRR-V3J2-97MH

GHSA-5PRR-V3J2-97MH is a medium-severity out-of-bounds read vulnerability in nokogiri (rubygems), affecting versions < 1.19.4. It is fixed in 1.19.4.

Summary

Nokogiri::XML::NodeSet#[] (and its alias #slice) checked the requested index against the node set's bounds using a 32-bit-truncated copy of the index. A large negative index could pass the check and then be used at full width, reading outside the node set's storage. On CRuby this is an out-of-bounds read that typically crashes the process; on JRuby it is not memory-unsafe but returns an incorrect node.

Nokogiri 1.19.4 performs the bounds check against the full-width index.

Severity

The Nokogiri maintainers have evaluated this as medium severity.

Exploitation requires an application to pass an attacker-controlled integer to NodeSet#[]. The primary impact is a controlled crash (denial of service), with potential for memory disclosure on CRuby.

On JRuby, Nokogiri is not affected by this vulnerability.

Mitigation

Upgrade to Nokogiri 1.19.4 or later.

As a workaround, applications that index a NodeSet with externally-supplied integers can validate the index against node_set.length before use, or avoid passing untrusted values as an index.

Credit

This issue was responsibly reported by Zheng Yu from depthfirst.com.

Impact

A read operation accesses a memory location beyond the intended buffer boundary. Typical impact: sensitive data disclosure or crash.

Affected versions

nokogiri (< 1.19.4)

Security releases

nokogiri → 1.19.4 (rubygems)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

Upgrade nokogiri to 1.19.4 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is GHSA-5PRR-V3J2-97MH? GHSA-5PRR-V3J2-97MH is a medium-severity out-of-bounds read vulnerability in nokogiri (rubygems), affecting versions < 1.19.4. It is fixed in 1.19.4. A read operation accesses a memory location beyond the intended buffer boundary.
  2. Which versions of nokogiri are affected by GHSA-5PRR-V3J2-97MH? nokogiri (rubygems) versions < 1.19.4 is affected.
  3. Is there a fix for GHSA-5PRR-V3J2-97MH? Yes. GHSA-5PRR-V3J2-97MH is fixed in 1.19.4. Upgrade to this version or later.
  4. Is GHSA-5PRR-V3J2-97MH exploitable, and should I be worried? Whether GHSA-5PRR-V3J2-97MH is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether GHSA-5PRR-V3J2-97MH is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix GHSA-5PRR-V3J2-97MH? Upgrade nokogiri to 1.19.4 or later.

Other vulnerabilities in nokogiri

Stop the waste.
Protect your environment with Kodem.