Junglewise Threat Intelligence

CVE-2026-57235: Nokogiri out-of-bounds read in NodeSet indexing

CVE-2026-57235 · Severity: medium · CVSS 4 · Published 2026-06-25

Technologies: nokogiri (RubyGems). Vendors: RubyGems.

Executive brief

Nokogiri is a widely used Ruby library for processing XML and HTML data. A vulnerability in how the library handles specific data requests could allow an attacker to crash an application or potentially access unintended memory. This could lead to service outages or the exposure of sensitive information if the application processes untrusted user input.

Technical details

An out-of-bounds read vulnerability exists in Nokogiri's NodeSet indexing logic due to integer truncation. The library's bounds-checking mechanism used a 32-bit truncated copy of the requested index, allowing large negative indices to bypass validation. When the full-width index is subsequently used for memory access, it results in an out-of-bounds read. On CRuby, this typically causes a process crash (DoS) or potential memory disclosure, while on JRuby it returns incorrect nodes. The vulnerability is reachable if an application passes attacker-controlled integers to the NodeSet#[] or #slice methods. This issue is fixed in version 1.19.4.

Affected products

  • sparklemotion Nokogiri < 1.19.4

Timeline

  • 2026-06-18: advisory: GitHub Security Advisory published by maintainers
  • 2026-06-25: disclosed: CVE published to NVD

References

Related threats