Answer in brief
CVE-2026-57236 records a High severity (CVSS 8.2) vulnerability in Nokogiri: Possible Use-After-Free when `Nokogiri::XML::Document#encoding=` raises an exception. The current sources do not mark it as known exploited. The current feed maps nokogiri (rubygems), nokogiri (rubygems). Check affected ranges and fixed versions before updating.
Analysis pending evidence review
HOL Guard separates source facts from reviewed analysis. See the methodology.
CVSS is 8.2. The current sources do not mark it as known exploited. Treat this as a source-backed prioritization signal, not a statement about your environment.
Analysis status
Analysis pending evidence review
Factual feed record only; HOL analysis is not approved for indexing. Read the methodology.
The current feed maps nokogiri (rubygems), nokogiri (rubygems). Check affected ranges and fixed versions before updating.
| Package | Affected range | Fixed version |
|---|---|---|
| nokogirirubygems | <1.19.4 | 1.19.4 |
| nokogirirubygems | >=0 <1.19.4 | 1.19.4 |
Published upstream
Jun 19, 2026
Evidence: source:osv:source_dates:source-dates:recordSource modified
Sep 10, 2026
Evidence: source:osv:source_dates:source-dates:recordFirst seen by HOL
Jun 19, 2026
### Summary 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. ### Severity The Nokogiri maintainers have evaluated this as low severity. Reaching it requires an unusual API-usage pattern that does not arise during normal use. The application must pass an invalid encoding to `Document#encoding=`, rescue the resulting exception, and then continue using the same document. Nokogiri 1.19.4 makes this pattern safe with no change to the public API. The document no longer references freed memory after the exception is raised. ### Mitigation Upgrade to Nokogiri 1.19.4 or later. If users are unable to upgrade, avoid passing attacker-controlled values to `Document#encoding=`. Applications that only assign developer-authored encodings are not directly exposed. ### Credit This issue was responsibly reported by Zheng Yu from depthfirst.com.
Quoted source text, attributed separately from HOL analysis.