CVE-2026-57437 Details
Description
Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, Nokogiri::XML::XPathContext did not keep its source document alive for garbage collection. If an XPathContext outlived its document and the document was collected, evaluating an XPath expression could read invalid memory and potentially segfault. This is only reachable when application code constructs an XPathContext directly and lets the document become unreachable while continuing to use the context. The normal Document#xpath, #css, and related search methods are not affected, and it is not triggerable by malicious document input. This vulnerability is fixed in 1.19.4.
A use-after-free vulnerability has been identified in the Nokogiri library for Ruby, specifically in the XML processing component. This issue arises in versions prior to 1.19.4, where the Nokogiri::XML::XPathContext did not properly manage the lifecycle of its source document, allowing it to be garbage collected while the context was still in use. This could lead to reading invalid memory and potentially causing a segmentation fault. The vulnerability is only exploitable when application code directly creates an XPathContext and allows the associated document to become unreachable, all while continuing to use the context. Notably, this issue does not affect the standard document search methods, such as Document#xpath or #css, and cannot be triggered by malicious document input.
Users are advised to upgrade to Nokogiri version 1.19.4 or later. As a temporary workaround, ensure that the source document remains referenced for the duration of any XPathContext created from it. The standard Document#xpath, #css, and related search methods already maintain this reference and are not affected by the vulnerability.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Jun 25, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-p67v-3w7g-wjg7 | [email protected] | MitigationVendor Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-416 | Use After Free | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| nokogiri nokogiri | < 1.19.4 |
CPE
Remediation
| |
Change History
3 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 26, 2026 | Initial Analysis | [email protected] |
| Jun 25, 2026 | CVE Modified | CISA-ADP |
| Jun 25, 2026 | New CVE Received | [email protected] |