{"id":"CVE-2026-57236","aliases":["GHSA-5v8h-3h3q-446p"],"url":"https://o3.security/vulnerability/CVE-2026-57236","summary":"Nokogiri: Possible Use-After-Free when `Nokogiri::XML::Document#encoding=` raises an exception","details":"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.","published":"2026-06-25T14:29:14.181Z","modified":"2026-08-12T03:51:28.435362736Z","cvss":null,"epss":{"score":0.00341,"percentile":0.27141,"asOf":"2026-09-09"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"RubyGems","name":"nokogiri","fixedVersion":"1.19.4"}],"fix":null,"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/57xxx/CVE-2026-57236.json"},{"type":"ADVISORY","url":"https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-5v8h-3h3q-446p"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-57236"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:28.435362736Z"}}