CVE-2026-57236
HighCVSS 8.2Exploitation Probability (EPSS)
Low risk25th percentile — higher than 25% of all known CVEs
Summary
Vulnerability in the Nokogiri library (versions prior to 1.19.4) for Ruby. Calling Document#encoding= with an invalid encoding (e.g., non-string or containing a null byte) frees the current encoding string without replacing it. Subsequent calls to Document#encoding read freed memory, potentially causing a segfault or leaking freed bytes into a Ruby String. Affects only the CRuby (libxml2) implementation; JRuby is not affected.
Risk Assessment
Risk includes application crashes (segfault) or potential leakage of sensitive memory data into user-visible strings, compromising system integrity and confidentiality.
Recommendation
Immediately update Nokogiri to version 1.19.4 or later. If unable to update, avoid passing invalid values to the Document#encoding= method.
Original NVD description (English source)
Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, calling Document#encoding= with an invalid encoding (e.g., a non-string, or a string containing a null byte) raises an exception, but only after freeing the document's current encoding string without replacing it. The document is left referencing freed memory, so the next call to Document#encoding reads invalid memory, which can cause a segfault or leak freed bytes into a Ruby String. Affects the CRuby (libxml2) implementation only; JRuby is not affected. This vulnerability is fixed in 1.19.4.

